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.

105 lines
4.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  19. #define __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__
  20. #include "../imaging/juce_Image.h"
  21. #include "../geometry/juce_Path.h"
  22. #include "../geometry/juce_RectangleList.h"
  23. #include "../colour/juce_ColourGradient.h"
  24. //==============================================================================
  25. /**
  26. Interface class for graphics context objects, used internally by the Graphics class.
  27. Users are not supposed to create instances of this class directly - do your drawing
  28. via the Graphics object instead.
  29. It's a base class for different types of graphics context, that may perform software-based
  30. or OS-accelerated rendering.
  31. E.g. the LowLevelGraphicsSoftwareRenderer renders onto an image in memory, but other
  32. subclasses could render directly to a windows HDC, a Quartz context, or an OpenGL
  33. context.
  34. */
  35. class JUCE_API LowLevelGraphicsContext
  36. {
  37. protected:
  38. //==============================================================================
  39. LowLevelGraphicsContext();
  40. public:
  41. virtual ~LowLevelGraphicsContext();
  42. /** Returns true if this device is vector-based, e.g. a printer. */
  43. virtual bool isVectorDevice() const = 0;
  44. //==============================================================================
  45. /** Moves the origin to a new position.
  46. The co-ords are relative to the current origin, and indicate the new position
  47. of (0, 0).
  48. */
  49. virtual void setOrigin (int x, int y) = 0;
  50. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  51. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  52. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  53. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  54. virtual void clipToImageAlpha (const Image& sourceImage, const Rectangle<int>& srcClip, const AffineTransform& transform) = 0;
  55. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  56. virtual const Rectangle<int> getClipBounds() const = 0;
  57. virtual bool isClipEmpty() const = 0;
  58. virtual void saveState() = 0;
  59. virtual void restoreState() = 0;
  60. //==============================================================================
  61. virtual void setFill (const FillType& fillType) = 0;
  62. virtual void setOpacity (float newOpacity) = 0;
  63. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  64. //==============================================================================
  65. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  66. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  67. virtual void drawImage (const Image& sourceImage, const Rectangle<int>& srcClip,
  68. const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  69. virtual void drawLine (double x1, double y1, double x2, double y2) = 0;
  70. virtual void drawVerticalLine (int x, double top, double bottom) = 0;
  71. virtual void drawHorizontalLine (int y, double left, double right) = 0;
  72. virtual void setFont (const Font& newFont) = 0;
  73. virtual const Font getFont() = 0;
  74. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  75. };
  76. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__