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.

97 lines
4.0KB

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