Audio plugin host https://kx.studio/carla
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.

juce_LowLevelGraphicsContext.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  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 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  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. @tags{Graphics}
  31. */
  32. class JUCE_API LowLevelGraphicsContext
  33. {
  34. protected:
  35. //==============================================================================
  36. LowLevelGraphicsContext() = default;
  37. public:
  38. virtual ~LowLevelGraphicsContext() = default;
  39. /** Returns true if this device is vector-based, e.g. a printer. */
  40. virtual bool isVectorDevice() const = 0;
  41. //==============================================================================
  42. /** Moves the origin to a new position.
  43. The coordinates are relative to the current origin, and indicate the new position
  44. of (0, 0).
  45. */
  46. virtual void setOrigin (Point<int>) = 0;
  47. virtual void addTransform (const AffineTransform&) = 0;
  48. virtual float getPhysicalPixelScaleFactor() = 0;
  49. virtual bool clipToRectangle (const Rectangle<int>&) = 0;
  50. virtual bool clipToRectangleList (const RectangleList<int>&) = 0;
  51. virtual void excludeClipRectangle (const Rectangle<int>&) = 0;
  52. virtual void clipToPath (const Path&, const AffineTransform&) = 0;
  53. virtual void clipToImageAlpha (const Image&, const AffineTransform&) = 0;
  54. virtual bool clipRegionIntersects (const Rectangle<int>&) = 0;
  55. virtual Rectangle<int> getClipBounds() const = 0;
  56. virtual bool isClipEmpty() const = 0;
  57. virtual void saveState() = 0;
  58. virtual void restoreState() = 0;
  59. virtual void beginTransparencyLayer (float opacity) = 0;
  60. virtual void endTransparencyLayer() = 0;
  61. //==============================================================================
  62. virtual void setFill (const FillType&) = 0;
  63. virtual void setOpacity (float) = 0;
  64. virtual void setInterpolationQuality (Graphics::ResamplingQuality) = 0;
  65. //==============================================================================
  66. virtual void fillRect (const Rectangle<int>&, bool replaceExistingContents) = 0;
  67. virtual void fillRect (const Rectangle<float>&) = 0;
  68. virtual void fillRectList (const RectangleList<float>&) = 0;
  69. virtual void fillPath (const Path&, const AffineTransform&) = 0;
  70. virtual void drawImage (const Image&, const AffineTransform&) = 0;
  71. virtual void drawLine (const Line<float>&) = 0;
  72. virtual void setFont (const Font&) = 0;
  73. virtual const Font& getFont() = 0;
  74. virtual void drawGlyph (int glyphNumber, const AffineTransform&) = 0;
  75. virtual bool drawTextLayout (const AttributedString&, const Rectangle<float>&) { return false; }
  76. };
  77. } // namespace juce