Audio plugin host https://kx.studio/carla
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.

juce_LowLevelGraphicsPostScriptRenderer.h 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. An implementation of LowLevelGraphicsContext that turns the drawing operations
  24. into a PostScript document.
  25. */
  26. class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
  27. {
  28. public:
  29. //==============================================================================
  30. LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
  31. const String& documentTitle,
  32. int totalWidth,
  33. int totalHeight);
  34. ~LowLevelGraphicsPostScriptRenderer();
  35. //==============================================================================
  36. bool isVectorDevice() const override;
  37. void setOrigin (Point<int>) override;
  38. void addTransform (const AffineTransform&) override;
  39. float getPhysicalPixelScaleFactor() override;
  40. bool clipToRectangle (const Rectangle<int>&) override;
  41. bool clipToRectangleList (const RectangleList<int>&) override;
  42. void excludeClipRectangle (const Rectangle<int>&) override;
  43. void clipToPath (const Path&, const AffineTransform&) override;
  44. void clipToImageAlpha (const Image&, const AffineTransform&) override;
  45. void saveState() override;
  46. void restoreState() override;
  47. void beginTransparencyLayer (float) override;
  48. void endTransparencyLayer() override;
  49. bool clipRegionIntersects (const Rectangle<int>&) override;
  50. Rectangle<int> getClipBounds() const override;
  51. bool isClipEmpty() const override;
  52. //==============================================================================
  53. void setFill (const FillType&) override;
  54. void setOpacity (float) override;
  55. void setInterpolationQuality (Graphics::ResamplingQuality) override;
  56. //==============================================================================
  57. void fillRect (const Rectangle<int>&, bool replaceExistingContents) override;
  58. void fillRect (const Rectangle<float>&) override;
  59. void fillRectList (const RectangleList<float>&) override;
  60. void fillPath (const Path&, const AffineTransform&) override;
  61. void drawImage (const Image&, const AffineTransform&) override;
  62. void drawLine (const Line <float>&) override;
  63. //==============================================================================
  64. const Font& getFont() override;
  65. void setFont (const Font&) override;
  66. void drawGlyph (int glyphNumber, const AffineTransform&) override;
  67. protected:
  68. //==============================================================================
  69. OutputStream& out;
  70. int totalWidth, totalHeight;
  71. bool needToClip;
  72. Colour lastColour;
  73. struct SavedState
  74. {
  75. SavedState();
  76. ~SavedState();
  77. RectangleList<int> clip;
  78. int xOffset, yOffset;
  79. FillType fillType;
  80. Font font;
  81. private:
  82. SavedState& operator= (const SavedState&);
  83. };
  84. OwnedArray <SavedState> stateStack;
  85. void writeClip();
  86. void writeColour (Colour colour);
  87. void writePath (const Path&) const;
  88. void writeXY (float x, float y) const;
  89. void writeTransform (const AffineTransform&) const;
  90. void writeImage (const Image&, int sx, int sy, int maxW, int maxH) const;
  91. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LowLevelGraphicsPostScriptRenderer)
  92. };
  93. } // namespace juce