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.

111 lines
4.7KB

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