The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. #pragma once
  20. //==============================================================================
  21. /**
  22. Interface class for graphics context objects, used internally by the Graphics class.
  23. Users are not supposed to create instances of this class directly - do your drawing
  24. via the Graphics object instead.
  25. It's a base class for different types of graphics context, that may perform software-based
  26. or OS-accelerated rendering.
  27. E.g. the LowLevelGraphicsSoftwareRenderer renders onto an image in memory, but other
  28. subclasses could render directly to a windows HDC, a Quartz context, or an OpenGL
  29. context.
  30. */
  31. class JUCE_API LowLevelGraphicsContext
  32. {
  33. protected:
  34. //==============================================================================
  35. LowLevelGraphicsContext();
  36. public:
  37. virtual ~LowLevelGraphicsContext();
  38. /** Returns true if this device is vector-based, e.g. a printer. */
  39. virtual bool isVectorDevice() const = 0;
  40. //==============================================================================
  41. /** Moves the origin to a new position.
  42. The coordinates are relative to the current origin, and indicate the new position
  43. of (0, 0).
  44. */
  45. virtual void setOrigin (Point<int>) = 0;
  46. virtual void addTransform (const AffineTransform&) = 0;
  47. virtual float getPhysicalPixelScaleFactor() = 0;
  48. virtual bool clipToRectangle (const Rectangle<int>&) = 0;
  49. virtual bool clipToRectangleList (const RectangleList<int>&) = 0;
  50. virtual void excludeClipRectangle (const Rectangle<int>&) = 0;
  51. virtual void clipToPath (const Path&, const AffineTransform&) = 0;
  52. virtual void clipToImageAlpha (const Image&, const AffineTransform&) = 0;
  53. virtual bool clipRegionIntersects (const Rectangle<int>&) = 0;
  54. virtual Rectangle<int> getClipBounds() const = 0;
  55. virtual bool isClipEmpty() const = 0;
  56. virtual void saveState() = 0;
  57. virtual void restoreState() = 0;
  58. virtual void beginTransparencyLayer (float opacity) = 0;
  59. virtual void endTransparencyLayer() = 0;
  60. //==============================================================================
  61. virtual void setFill (const FillType&) = 0;
  62. virtual void setOpacity (float) = 0;
  63. virtual void setInterpolationQuality (Graphics::ResamplingQuality) = 0;
  64. //==============================================================================
  65. virtual void fillRect (const Rectangle<int>&, bool replaceExistingContents) = 0;
  66. virtual void fillRect (const Rectangle<float>&) = 0;
  67. virtual void fillRectList (const RectangleList<float>&) = 0;
  68. virtual void fillPath (const Path&, const AffineTransform&) = 0;
  69. virtual void drawImage (const Image&, const AffineTransform&) = 0;
  70. virtual void drawLine (const Line<float>&) = 0;
  71. virtual void setFont (const Font&) = 0;
  72. virtual const Font& getFont() = 0;
  73. virtual void drawGlyph (int glyphNumber, const AffineTransform&) = 0;
  74. virtual bool drawTextLayout (const AttributedString&, const Rectangle<float>&) { return false; }
  75. };