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.

110 lines
4.6KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 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 "../images/juce_Image.h"
  21. #include "../geometry/juce_Path.h"
  22. #include "../geometry/juce_RectangleList.h"
  23. #include "../colour/juce_ColourGradient.h"
  24. #include "../colour/juce_FillType.h"
  25. //==============================================================================
  26. /**
  27. Interface class for graphics context objects, used internally by the Graphics class.
  28. Users are not supposed to create instances of this class directly - do your drawing
  29. via the Graphics object instead.
  30. It's a base class for different types of graphics context, that may perform software-based
  31. or OS-accelerated rendering.
  32. E.g. the LowLevelGraphicsSoftwareRenderer renders onto an image in memory, but other
  33. subclasses could render directly to a windows HDC, a Quartz context, or an OpenGL
  34. context.
  35. */
  36. class JUCE_API LowLevelGraphicsContext
  37. {
  38. protected:
  39. //==============================================================================
  40. LowLevelGraphicsContext();
  41. public:
  42. virtual ~LowLevelGraphicsContext();
  43. /** Returns true if this device is vector-based, e.g. a printer. */
  44. virtual bool isVectorDevice() const = 0;
  45. //==============================================================================
  46. /** Moves the origin to a new position.
  47. The co-ords are relative to the current origin, and indicate the new position
  48. of (0, 0).
  49. */
  50. virtual void setOrigin (int x, int y) = 0;
  51. virtual void addTransform (const AffineTransform& transform) = 0;
  52. virtual float getScaleFactor() = 0;
  53. virtual bool clipToRectangle (const Rectangle<int>& r) = 0;
  54. virtual bool clipToRectangleList (const RectangleList& clipRegion) = 0;
  55. virtual void excludeClipRectangle (const Rectangle<int>& r) = 0;
  56. virtual void clipToPath (const Path& path, const AffineTransform& transform) = 0;
  57. virtual void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform) = 0;
  58. virtual bool clipRegionIntersects (const Rectangle<int>& r) = 0;
  59. virtual Rectangle<int> getClipBounds() const = 0;
  60. virtual bool isClipEmpty() const = 0;
  61. virtual void saveState() = 0;
  62. virtual void restoreState() = 0;
  63. virtual void beginTransparencyLayer (float opacity) = 0;
  64. virtual void endTransparencyLayer() = 0;
  65. //==============================================================================
  66. virtual void setFill (const FillType& fillType) = 0;
  67. virtual void setOpacity (float newOpacity) = 0;
  68. virtual void setInterpolationQuality (Graphics::ResamplingQuality quality) = 0;
  69. //==============================================================================
  70. virtual void fillRect (const Rectangle<int>& r, bool replaceExistingContents) = 0;
  71. virtual void fillPath (const Path& path, const AffineTransform& transform) = 0;
  72. virtual void drawImage (const Image& sourceImage, const AffineTransform& transform, bool fillEntireClipAsTiles) = 0;
  73. virtual void drawLine (const Line <float>& line) = 0;
  74. virtual void drawVerticalLine (int x, float top, float bottom) = 0;
  75. virtual void drawHorizontalLine (int y, float left, float right) = 0;
  76. virtual void setFont (const Font& newFont) = 0;
  77. virtual Font getFont() = 0;
  78. virtual void drawGlyph (int glyphNumber, const AffineTransform& transform) = 0;
  79. };
  80. #endif // __JUCE_LOWLEVELGRAPHICSCONTEXT_JUCEHEADER__