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 //==============================================================================
34 An implementation of LowLevelGraphicsContext that turns the drawing operations
35 into a PostScript document.
38 class JUCE_API LowLevelGraphicsPostScriptRenderer
: public LowLevelGraphicsContext
41 //==============================================================================
42 LowLevelGraphicsPostScriptRenderer (OutputStream
& resultingPostScript
,
43 const String
& documentTitle
,
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
);
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 //==============================================================================
89 void setFont (const Font
& newFont
);
90 void drawGlyph (int glyphNumber
, const AffineTransform
& transform
);
93 //==============================================================================
95 int totalWidth
, totalHeight
;
105 int xOffset
, yOffset
;
110 SavedState
& operator= (const SavedState
&);
113 OwnedArray
<SavedState
> stateStack
;
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__