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.

96 lines
3.7KB

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