Add remaining files
[juce-lv2.git] / juce / source / src / gui / graphics / contexts / juce_LowLevelGraphicsPostScriptRenderer.h
blob889be4a95b4052778016e1160f49580bfd9c46a2
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
27 #define __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__
29 #include "juce_LowLevelGraphicsContext.h"
32 //==============================================================================
33 /**
34 An implementation of LowLevelGraphicsContext that turns the drawing operations
35 into a PostScript document.
38 class JUCE_API LowLevelGraphicsPostScriptRenderer : public LowLevelGraphicsContext
40 public:
41 //==============================================================================
42 LowLevelGraphicsPostScriptRenderer (OutputStream& resultingPostScript,
43 const String& documentTitle,
44 int totalWidth,
45 int totalHeight);
47 ~LowLevelGraphicsPostScriptRenderer();
49 //==============================================================================
50 bool isVectorDevice() const;
51 void setOrigin (int x, int y);
52 void addTransform (const AffineTransform& transform);
53 float getScaleFactor();
55 bool clipToRectangle (const Rectangle<int>& r);
56 bool clipToRectangleList (const RectangleList& clipRegion);
57 void excludeClipRectangle (const Rectangle<int>& r);
58 void clipToPath (const Path& path, const AffineTransform& transform);
59 void clipToImageAlpha (const Image& sourceImage, const AffineTransform& transform);
61 void saveState();
62 void restoreState();
64 void beginTransparencyLayer (float opacity);
65 void endTransparencyLayer();
67 bool clipRegionIntersects (const Rectangle<int>& r);
68 const Rectangle<int> getClipBounds() const;
69 bool isClipEmpty() const;
71 //==============================================================================
72 void setFill (const FillType& fillType);
73 void setOpacity (float opacity);
74 void setInterpolationQuality (Graphics::ResamplingQuality quality);
76 //==============================================================================
77 void fillRect (const Rectangle<int>& r, bool replaceExistingContents);
78 void fillPath (const Path& path, const AffineTransform& transform);
80 void drawImage (const Image& sourceImage, const AffineTransform& transform, bool fillEntireClipAsTiles);
82 void drawLine (const Line <float>& line);
84 void drawVerticalLine (int x, float top, float bottom);
85 void drawHorizontalLine (int x, float top, float bottom);
87 //==============================================================================
88 Font getFont();
89 void setFont (const Font& newFont);
90 void drawGlyph (int glyphNumber, const AffineTransform& transform);
92 protected:
93 //==============================================================================
94 OutputStream& out;
95 int totalWidth, totalHeight;
96 bool needToClip;
97 Colour lastColour;
99 struct SavedState
101 SavedState();
102 ~SavedState();
104 RectangleList clip;
105 int xOffset, yOffset;
106 FillType fillType;
107 Font font;
109 private:
110 SavedState& operator= (const SavedState&);
113 OwnedArray <SavedState> stateStack;
115 void writeClip();
116 void writeColour (const Colour& colour);
117 void writePath (const Path& path) const;
118 void writeXY (float x, float y) const;
119 void writeTransform (const AffineTransform& trans) const;
120 void writeImage (const Image& im, int sx, int sy, int maxW, int maxH) const;
122 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LowLevelGraphicsPostScriptRenderer);
127 #endif // __JUCE_LOWLEVELGRAPHICSPOSTSCRIPTRENDERER_JUCEHEADER__