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.

113 lines
4.5KB

  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_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  19. #define __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__
  20. #include "juce_LowLevelGraphicsContext.h"
  21. //==============================================================================
  22. /**
  23. A lowest-common-denominator implementation of LowLevelGraphicsContext that does all
  24. its rendering in memory.
  25. User code is not supposed to create instances of this class directly - do all your
  26. rendering via the Graphics class instead.
  27. */
  28. class JUCE_API LowLevelGraphicsSoftwareRenderer : public LowLevelGraphicsContext
  29. {
  30. public:
  31. //==============================================================================
  32. LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOn);
  33. LowLevelGraphicsSoftwareRenderer (const Image& imageToRenderOn, int xOffset, int yOffset, const RectangleList& initialClip);
  34. ~LowLevelGraphicsSoftwareRenderer();
  35. bool isVectorDevice() const;
  36. //==============================================================================
  37. void setOrigin (int x, int y);
  38. void addTransform (const AffineTransform& transform);
  39. float getScaleFactor();
  40. bool clipToRectangle (const Rectangle<int>& r);
  41. bool clipToRectangleList (const RectangleList& clipRegion);
  42. void excludeClipRectangle (const Rectangle<int>& r);
  43. void clipToPath (const Path& path, const AffineTransform& transform);
  44. void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform);
  45. bool clipRegionIntersects (const Rectangle<int>& r);
  46. Rectangle<int> getClipBounds() const;
  47. bool isClipEmpty() const;
  48. void saveState();
  49. void restoreState();
  50. void beginTransparencyLayer (float opacity);
  51. void endTransparencyLayer();
  52. //==============================================================================
  53. void setFill (const FillType& fillType);
  54. void setOpacity (float opacity);
  55. void setInterpolationQuality (Graphics::ResamplingQuality quality);
  56. //==============================================================================
  57. void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
  58. void fillPath (const Path& path, const AffineTransform& transform);
  59. void drawImage (const Image& sourceImage, const AffineTransform& transform, bool fillEntireClipAsTiles);
  60. void drawLine (const Line <float>& line);
  61. void drawVerticalLine (int x, float top, float bottom);
  62. void drawHorizontalLine (int x, float top, float bottom);
  63. //==============================================================================
  64. void setFont (const Font& newFont);
  65. Font getFont();
  66. void drawGlyph (int glyphNumber, float x, float y);
  67. void drawGlyph (int glyphNumber, const AffineTransform& transform);
  68. protected:
  69. //==============================================================================
  70. Image image;
  71. class GlyphCache;
  72. class CachedGlyph;
  73. class SavedState;
  74. friend class ScopedPointer <SavedState>;
  75. friend class OwnedArray <SavedState>;
  76. friend class OwnedArray <CachedGlyph>;
  77. ScopedPointer <SavedState> currentState;
  78. OwnedArray <SavedState> stateStack;
  79. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LowLevelGraphicsSoftwareRenderer);
  80. };
  81. #endif // __JUCE_LOWLEVELGRAPHICSSOFTWARERENDERER_JUCEHEADER__