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.

109 lines
4.4KB

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