xref: /aoo42x/main/vcl/inc/vcl/graphictools.hxx (revision 0d63794c)
1*0d63794cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0d63794cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0d63794cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0d63794cSAndrew Rist  * distributed with this work for additional information
6*0d63794cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0d63794cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0d63794cSAndrew Rist  * "License"); you may not use this file except in compliance
9*0d63794cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0d63794cSAndrew Rist  *
11*0d63794cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0d63794cSAndrew Rist  *
13*0d63794cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0d63794cSAndrew Rist  * software distributed under the License is distributed on an
15*0d63794cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0d63794cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*0d63794cSAndrew Rist  * specific language governing permissions and limitations
18*0d63794cSAndrew Rist  * under the License.
19*0d63794cSAndrew Rist  *
20*0d63794cSAndrew Rist  *************************************************************/
21*0d63794cSAndrew Rist 
22*0d63794cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _VCL_GRAPHICTOOLS_HXX_
25cdf0e10cSrcweir #define _VCL_GRAPHICTOOLS_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/dllapi.h>
28cdf0e10cSrcweir #include <sal/types.h>
29cdf0e10cSrcweir #include <rtl/string.hxx>
30cdf0e10cSrcweir #include <tools/color.hxx>
31cdf0e10cSrcweir #include <tools/poly.hxx>
32cdf0e10cSrcweir #include <tools/stream.hxx>
33cdf0e10cSrcweir #include <vcl/graph.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #ifndef INCLUDED_MEMORY
36cdf0e10cSrcweir #include <memory>
37cdf0e10cSrcweir #define INCLUDED_MEMORY
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #ifndef INCLUDED_VECTOR
41cdf0e10cSrcweir #include <vector>
42cdf0e10cSrcweir #define INCLUDED_VECTOR
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir 
45cdf0e10cSrcweir /** Encapsulates geometry and associated attributes of a graphical 'pen stroke'
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     @attention Widespread use is deprecated. See declarations above
48cdf0e10cSrcweir     for the way to go. Especially the copied enums from svx/xenum.hxx
49cdf0e10cSrcweir     are troublesome.
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	Use this class to store geometry and attributes of a graphical
52cdf0e10cSrcweir 	'pen stroke', such as pen width, dashing etc. The geometry is the
53cdf0e10cSrcweir 	so-called 'path' along which the stroke is traced, with the given
54cdf0e10cSrcweir 	pen width. The cap type determines how the open ends of the path
55cdf0e10cSrcweir 	should be drawn. If the geometry consists of more than one
56cdf0e10cSrcweir 	segment, the join type determines in which way the segments are
57cdf0e10cSrcweir 	joined.
58cdf0e10cSrcweir  */
59cdf0e10cSrcweir class VCL_DLLPUBLIC SvtGraphicStroke
60cdf0e10cSrcweir {
61cdf0e10cSrcweir public:
62cdf0e10cSrcweir     /// Style for open stroke ends
63cdf0e10cSrcweir     enum CapType
64cdf0e10cSrcweir     {
65cdf0e10cSrcweir         /// No additional cap
66cdf0e10cSrcweir         capButt=0,
67cdf0e10cSrcweir         /// Half-round cap at the line end, the center lying at the end point
68cdf0e10cSrcweir         capRound,
69cdf0e10cSrcweir         /// Half-square cap at the line end, the center lying at the end point
70cdf0e10cSrcweir         capSquare
71cdf0e10cSrcweir     };
72cdf0e10cSrcweir     /// Style for joins of individual stroke segments
73cdf0e10cSrcweir     enum JoinType
74cdf0e10cSrcweir     {
75cdf0e10cSrcweir         /// Extend segment edges, until they cross
76cdf0e10cSrcweir         joinMiter=0,
77cdf0e10cSrcweir         /// Connect segments by a filled round arc
78cdf0e10cSrcweir         joinRound,
79cdf0e10cSrcweir         /// Connect segments by a direct straight line
80cdf0e10cSrcweir         joinBevel,
81cdf0e10cSrcweir         /// Perform no join, leads to visible gaps between thick line segments
82cdf0e10cSrcweir         joinNone
83cdf0e10cSrcweir     };
84cdf0e10cSrcweir     enum
85cdf0e10cSrcweir     {
86cdf0e10cSrcweir         /// Width of stroke start/end arrow to exactly fit the joining stroke
87cdf0e10cSrcweir         normalizedArrowWidth=65536
88cdf0e10cSrcweir     };
89cdf0e10cSrcweir     typedef ::std::vector< double > DashArray;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     SvtGraphicStroke();
92cdf0e10cSrcweir     /** All in one constructor
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     	See accessor method descriptions for argument description
95cdf0e10cSrcweir      */
96cdf0e10cSrcweir     SvtGraphicStroke( const Polygon& 		rPath,
97cdf0e10cSrcweir                       const PolyPolygon&	rStartArrow,
98cdf0e10cSrcweir                       const PolyPolygon&	rEndArrow,
99cdf0e10cSrcweir                       double				fTransparency,
100cdf0e10cSrcweir                       double 				fStrokeWidth,
101cdf0e10cSrcweir                       CapType				aCap,
102cdf0e10cSrcweir                       JoinType				aJoin,
103cdf0e10cSrcweir                       double 				fMiterLimit,
104cdf0e10cSrcweir                       const DashArray&		rDashArray	);		// TODO: Dash array offset (position where to start, see PS)
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // accessors
107cdf0e10cSrcweir     /// Query path to stroke
108cdf0e10cSrcweir     void		 	getPath				( Polygon& ) const;
109cdf0e10cSrcweir     /** Get the polygon that is put at the start of the line
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     	The polygon is in a special normalized position: the center of
112cdf0e10cSrcweir     	the stroked path will meet the given polygon at (0,0) from
113cdf0e10cSrcweir     	negative y values. Thus, an arrow would have its baseline on
114cdf0e10cSrcweir     	the x axis, going upwards to positive y values. Furthermore,
115cdf0e10cSrcweir     	the polygon is also scaled in a special way: the width of the
116cdf0e10cSrcweir     	joining stroke is defined to be
117cdf0e10cSrcweir     	SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging
118cdf0e10cSrcweir     	from x=-0x8000 to x=0x8000. So, if the arrow does have this
119cdf0e10cSrcweir     	width, it has to fit every stroke with every stroke width
120cdf0e10cSrcweir     	exactly.
121cdf0e10cSrcweir      */
122cdf0e10cSrcweir     void		 	getStartArrow		( PolyPolygon& ) const;
123cdf0e10cSrcweir     /** Get the polygon that is put at the end of the line
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     	The polygon is in a special normalized position, and already
126cdf0e10cSrcweir     	scaled to the desired size: the center of the stroked path
127cdf0e10cSrcweir     	will meet the given polygon at (0,0) from negative y
128cdf0e10cSrcweir     	values. Thus, an arrow would have its baseline on the x axis,
129cdf0e10cSrcweir     	going upwards to positive y values. Furthermore, the polygon
130cdf0e10cSrcweir     	is also scaled in a special way: the width of the joining
131cdf0e10cSrcweir     	stroke is defined to be SvtGraphicStroke::normalizedArrowWidth
132cdf0e10cSrcweir     	(0x10000), i.e. ranging from x=-0x8000 to x=0x8000. So, if the
133cdf0e10cSrcweir     	arrow does have this width, it has to fit every stroke with
134cdf0e10cSrcweir     	every stroke width exactly.
135cdf0e10cSrcweir      */
136cdf0e10cSrcweir     void		 	getEndArrow			( PolyPolygon& ) const;
137cdf0e10cSrcweir     /** Get stroke transparency
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     	@return the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)
140cdf0e10cSrcweir      */
141cdf0e10cSrcweir     double 			getTransparency		() const;
142cdf0e10cSrcweir     /// Get width of the stroke
143cdf0e10cSrcweir     double			getStrokeWidth		() const;
144cdf0e10cSrcweir     /// Get the style in which open stroke ends are drawn
145cdf0e10cSrcweir     CapType			getCapType			() const;
146cdf0e10cSrcweir     /// Get the style in which the stroke segments are joined
147cdf0e10cSrcweir     JoinType		getJoinType			() const;
148cdf0e10cSrcweir     /// Get the maximum length of mitered joins
149cdf0e10cSrcweir     double			getMiterLimit		() const;
150cdf0e10cSrcweir     /// Get an array of "on" and "off" lengths for stroke dashing
151cdf0e10cSrcweir     void			getDashArray		( DashArray& ) const;
152cdf0e10cSrcweir     /// Query a textual representation of the object's content
153cdf0e10cSrcweir     ::rtl::OString	toString			() const;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     // mutators
156cdf0e10cSrcweir     /// Set path to stroke
157cdf0e10cSrcweir     void	setPath				( const Polygon& );
158cdf0e10cSrcweir     /** Set the polygon that is put at the start of the line
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     	The polygon has to be in a special normalized position, and
161cdf0e10cSrcweir     	already scaled to the desired size: the center of the stroked
162cdf0e10cSrcweir     	path will meet the given polygon at (0,0) from negative y
163cdf0e10cSrcweir     	values. Thus, an arrow would have its baseline on the x axis,
164cdf0e10cSrcweir     	going upwards to positive y values. Furthermore, the polygon
165cdf0e10cSrcweir     	also has to be scaled appropriately: the width of the joining
166cdf0e10cSrcweir     	stroke is defined to be SvtGraphicStroke::normalizedArrowWidth
167cdf0e10cSrcweir     	(0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your
168cdf0e10cSrcweir     	arrow does have this width, it will fit every stroke with
169cdf0e10cSrcweir     	every stroke width exactly.
170cdf0e10cSrcweir      */
171cdf0e10cSrcweir     void	setStartArrow		( const PolyPolygon& );
172cdf0e10cSrcweir     /** Set the polygon that is put at the end of the line
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     	The polygon has to be in a special normalized position, and
175cdf0e10cSrcweir     	already scaled to the desired size: the center of the stroked
176cdf0e10cSrcweir     	path will meet the given polygon at (0,0) from negative y
177cdf0e10cSrcweir     	values. Thus, an arrow would have its baseline on the x axis,
178cdf0e10cSrcweir     	going upwards to positive y values. Furthermore, the polygon
179cdf0e10cSrcweir     	also has to be scaled appropriately: the width of the joining
180cdf0e10cSrcweir     	stroke is defined to be SvtGraphicStroke::normalizedArrowWidth
181cdf0e10cSrcweir     	(0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your
182cdf0e10cSrcweir     	arrow does have this width, it will fit every stroke with
183cdf0e10cSrcweir     	every stroke width exactly.
184cdf0e10cSrcweir      */
185cdf0e10cSrcweir     void	setEndArrow			( const PolyPolygon& );
186cdf0e10cSrcweir     /** Set stroke transparency
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     	@param fTrans
189cdf0e10cSrcweir         The transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)
190cdf0e10cSrcweir      */
191cdf0e10cSrcweir     void	setTransparency		( double fTrans );
192cdf0e10cSrcweir     /// Set width of the stroke
193cdf0e10cSrcweir     void	setStrokeWidth		( double );
194cdf0e10cSrcweir     /// Set the style in which open stroke ends are drawn
195cdf0e10cSrcweir     void 	setCapType			( CapType );
196cdf0e10cSrcweir     /// Set the style in which the stroke segments are joined
197cdf0e10cSrcweir     void	setJoinType			( JoinType );
198cdf0e10cSrcweir     /// Set the maximum length of mitered joins
199cdf0e10cSrcweir     void	setMiterLimit		( double );
200cdf0e10cSrcweir     /// Set the array of "on" and "off" lengths for stroke dashing
201cdf0e10cSrcweir     void	setDashArray		( const DashArray& );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir private:
204cdf0e10cSrcweir     // friends
205cdf0e10cSrcweir 	VCL_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const SvtGraphicStroke& rClass );
206cdf0e10cSrcweir 	VCL_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, SvtGraphicStroke& rClass );
207cdf0e10cSrcweir 
208cdf0e10cSrcweir     Polygon			maPath;
209cdf0e10cSrcweir     PolyPolygon		maStartArrow;
210cdf0e10cSrcweir     PolyPolygon		maEndArrow;
211cdf0e10cSrcweir     double			mfTransparency;
212cdf0e10cSrcweir     double			mfStrokeWidth;
213cdf0e10cSrcweir     CapType			maCapType;
214cdf0e10cSrcweir     JoinType		maJoinType;
215cdf0e10cSrcweir     double 			mfMiterLimit;
216cdf0e10cSrcweir     DashArray		maDashArray;
217cdf0e10cSrcweir };
218cdf0e10cSrcweir 
219cdf0e10cSrcweir /** Encapsulates geometry and associated attributes of a filled area
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     @attention Widespread use is deprecated. See declarations above
222cdf0e10cSrcweir     for the way to go. Especially the copied enums from svx/xenum.hxx
223cdf0e10cSrcweir     is troublesome.
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	Use this class to store geometry and attributes of a filled area,
226cdf0e10cSrcweir 	such as fill color, transparency, texture or hatch.  The geometry
227cdf0e10cSrcweir 	is the so-called 'path', whose inner area will get filled
228cdf0e10cSrcweir 	according to the attributes set. If the path is intersecting, or
229cdf0e10cSrcweir 	one part of the path is lying fully within another part, then the
230cdf0e10cSrcweir 	fill rule determines which parts are filled and which are not.
231cdf0e10cSrcweir  */
232cdf0e10cSrcweir class VCL_DLLPUBLIC SvtGraphicFill
233cdf0e10cSrcweir {
234cdf0e10cSrcweir public:
235cdf0e10cSrcweir     /// Type of fill algorithm used
236cdf0e10cSrcweir     enum FillRule
237cdf0e10cSrcweir     {
238cdf0e10cSrcweir         /** Non-zero winding rule
239cdf0e10cSrcweir 
240cdf0e10cSrcweir         	Fill shape scanline-wise. Starting at the left, determine
241cdf0e10cSrcweir         	the winding number as follows: every segment crossed that
242cdf0e10cSrcweir         	runs counter-clockwise adds one to the winding number,
243cdf0e10cSrcweir         	every segment crossed that runs clockwise subtracts
244cdf0e10cSrcweir         	one. The part of the scanline where the winding number is
245cdf0e10cSrcweir         	non-zero gets filled.
246cdf0e10cSrcweir          */
247cdf0e10cSrcweir         fillNonZero=0,
248cdf0e10cSrcweir         /** Even-odd fill rule
249cdf0e10cSrcweir 
250cdf0e10cSrcweir         	Fill shape scanline-wise. Starting at the left, count the
251cdf0e10cSrcweir         	number of segments crossed. If this number is odd, the
252cdf0e10cSrcweir         	part of the scanline is filled, otherwise not.
253cdf0e10cSrcweir          */
254cdf0e10cSrcweir         fillEvenOdd
255cdf0e10cSrcweir     };
256cdf0e10cSrcweir     /// Type of filling used
257cdf0e10cSrcweir     enum FillType
258cdf0e10cSrcweir     {
259cdf0e10cSrcweir         /// Fill with a specified solid color
260cdf0e10cSrcweir         fillSolid=0,
261cdf0e10cSrcweir         /// Fill with the specified gradient
262cdf0e10cSrcweir         fillGradient,
263cdf0e10cSrcweir         /// Fill with the specified hatch
264cdf0e10cSrcweir         fillHatch,
265cdf0e10cSrcweir         /// Fill with the specified texture (a Graphic object)
266cdf0e10cSrcweir         fillTexture
267cdf0e10cSrcweir     };
268cdf0e10cSrcweir     /// Type of hatching used
269cdf0e10cSrcweir     enum HatchType
270cdf0e10cSrcweir     {
271cdf0e10cSrcweir         /// horizontal parallel lines, one unit apart
272cdf0e10cSrcweir         hatchSingle=0,
273cdf0e10cSrcweir         /// horizontal and verticall orthogonally crossing lines, one unit apart
274cdf0e10cSrcweir         hatchDouble,
275cdf0e10cSrcweir         /// three crossing lines, like HatchType::hatchDouble, but
276cdf0e10cSrcweir         /// with an additional diagonal line, rising to the upper
277cdf0e10cSrcweir         /// right corner. The first diagonal line goes through the
278cdf0e10cSrcweir         /// upper left corner, the other are each spaced a unit apart.
279cdf0e10cSrcweir         hatchTriple
280cdf0e10cSrcweir     };
281cdf0e10cSrcweir     /// Type of gradient used
282cdf0e10cSrcweir     enum GradientType {gradientLinear=0, gradientRadial, gradientRectangular};
283cdf0e10cSrcweir     /// Special values for gradient step count
284cdf0e10cSrcweir     enum { gradientStepsInfinite=0 };
285cdf0e10cSrcweir     /** Homogeneous 2D transformation matrix
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 		This is a 2x3 matrix representing an affine transformation on
288cdf0e10cSrcweir 		the R^2, in the usual C/C++ row major form. It is structured as follows:
289cdf0e10cSrcweir         <pre>
290cdf0e10cSrcweir         a b t_x
291cdf0e10cSrcweir         c d t_y
292cdf0e10cSrcweir         0 0 1
293cdf0e10cSrcweir         </pre>
294cdf0e10cSrcweir         where the lowest line is not stored in the matrix, since it is
295cdf0e10cSrcweir         constant. Variables t_x and t_y contain translational
296cdf0e10cSrcweir         components, a to d rotation, scale and shear (for details,
297cdf0e10cSrcweir         look up your favorite linear algebra/computer graphics book).
298cdf0e10cSrcweir      */
299cdf0e10cSrcweir     struct VCL_DLLPUBLIC Transform
300cdf0e10cSrcweir     {
301cdf0e10cSrcweir         enum { MatrixSize=6 };
302cdf0e10cSrcweir         Transform();
303cdf0e10cSrcweir         double matrix[MatrixSize];
304cdf0e10cSrcweir     };
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     SvtGraphicFill();
307cdf0e10cSrcweir     /** All in one constructor
308cdf0e10cSrcweir 
309cdf0e10cSrcweir     	See accessor method descriptions for argument description
310cdf0e10cSrcweir      */
311cdf0e10cSrcweir     SvtGraphicFill( const PolyPolygon& 	rPath,
312cdf0e10cSrcweir                     Color				aFillColor,
313cdf0e10cSrcweir                     double				fTransparency,
314cdf0e10cSrcweir                     FillRule			aFillRule,
315cdf0e10cSrcweir                     FillType			aFillType,				// TODO: Multitexturing
316cdf0e10cSrcweir                     const Transform&	aFillTransform,
317cdf0e10cSrcweir                     bool				bTiling,
318cdf0e10cSrcweir                     HatchType			aHatchType,				// TODO: vector of directions and start points
319cdf0e10cSrcweir                     Color				aHatchColor,
320cdf0e10cSrcweir                     GradientType		aGradientType,			// TODO: Transparent gradients (orthogonal to normal ones)
321cdf0e10cSrcweir                     Color				aGradient1stColor,		// TODO: vector of colors and offsets
322cdf0e10cSrcweir                     Color				aGradient2ndColor,
323cdf0e10cSrcweir                     int					aGradientStepCount,		// numbers of steps to render the gradient. gradientStepsInfinite means infinitely many.
324cdf0e10cSrcweir                     const Graphic&		aFillGraphic );
325cdf0e10cSrcweir 
326cdf0e10cSrcweir     // accessors
327cdf0e10cSrcweir     /// Query path to fill
328cdf0e10cSrcweir     void		 	getPath				( PolyPolygon& ) const;
329cdf0e10cSrcweir     /// Get color used for solid fills
330cdf0e10cSrcweir     Color		 	getFillColor		() const;
331cdf0e10cSrcweir     /** Get stroke transparency
332cdf0e10cSrcweir 
333cdf0e10cSrcweir     	@return the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)
334cdf0e10cSrcweir      */
335cdf0e10cSrcweir     double 			getTransparency		() const;
336cdf0e10cSrcweir     /// Get fill rule used
337cdf0e10cSrcweir     FillRule		getFillRule			() const;
338cdf0e10cSrcweir     /** Get fill type used
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 		Currently, only one of the fill types can be used
341cdf0e10cSrcweir 		simultaneously. If you specify e.g. FillRule::fillGradient,
342cdf0e10cSrcweir 		hatching, texture and solid fill color are ignored.
343cdf0e10cSrcweir      */
344cdf0e10cSrcweir     FillType		getFillType			() const;
345cdf0e10cSrcweir     /** Get transformation applied to hatch, gradient or texture during fill
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 		A fill operation generally starts at the top left position of
348cdf0e10cSrcweir 		the object's bounding box. At that position (if tiling is on,
349cdf0e10cSrcweir 		also all successive positions), the specified fill graphic is
350cdf0e10cSrcweir 		rendered, after applying the fill transformation to it. For
351cdf0e10cSrcweir 		example, if the fill transformation contains a translation,
352cdf0e10cSrcweir 		the fill graphic is rendered at the object's bounding box's
353cdf0e10cSrcweir 		top left corner plus the translation components.
354cdf0e10cSrcweir 
355cdf0e10cSrcweir      */
356cdf0e10cSrcweir     void			getTransform		( Transform& ) const;
357cdf0e10cSrcweir     /// deprecated
358cdf0e10cSrcweir     bool			IsTiling			() const;
359cdf0e10cSrcweir     /** Query state of texture tiling
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     	@return true, if texture is tiled, false, if output only once.
362cdf0e10cSrcweir      */
363cdf0e10cSrcweir     bool			isTiling			() const;
364cdf0e10cSrcweir     /// Get type of hatch used
365cdf0e10cSrcweir     HatchType		getHatchType		() const;
366cdf0e10cSrcweir     /// Get color used for drawing the hatch
367cdf0e10cSrcweir     Color			getHatchColor		() const;
368cdf0e10cSrcweir     /// Get type of gradient used
369cdf0e10cSrcweir     GradientType	getGradientType		() const;
370cdf0e10cSrcweir     /// Get start color of the gradient
371cdf0e10cSrcweir     Color			getGradient1stColor	() const;
372cdf0e10cSrcweir     /// Get end color of the gradient
373cdf0e10cSrcweir     Color			getGradient2ndColor	() const;
374cdf0e10cSrcweir     /** Get the numbers of steps to render the gradient.
375cdf0e10cSrcweir 
376cdf0e10cSrcweir         @return the step count. gradientStepsInfinite means infinitely many.
377cdf0e10cSrcweir     */
378cdf0e10cSrcweir     int				getGradientStepCount() const;
379cdf0e10cSrcweir     /** Get the texture graphic used
380cdf0e10cSrcweir 
381cdf0e10cSrcweir     	The Graphic object returned is used to fill the geometry, if
382cdf0e10cSrcweir     	the FillType is fillTexture. The Graphic object is always
383cdf0e10cSrcweir     	assumed to be of size 1x1, the transformation is used to scale
384cdf0e10cSrcweir     	it to the appropriate size.
385cdf0e10cSrcweir      */
386cdf0e10cSrcweir     void			getGraphic			( Graphic& ) const;
387cdf0e10cSrcweir     /// Query a textual representation of the object's content
388cdf0e10cSrcweir     ::rtl::OString	toString			() const;
389cdf0e10cSrcweir 
390cdf0e10cSrcweir     // mutators
391cdf0e10cSrcweir     /// Set path to fill
392cdf0e10cSrcweir     void 	setPath				( const PolyPolygon& rPath );
393cdf0e10cSrcweir     /// Set color used for solid fills
394cdf0e10cSrcweir     void 	setFillColor		( Color aFillColor );
395cdf0e10cSrcweir     /** Set stroke transparency
396cdf0e10cSrcweir 
397cdf0e10cSrcweir     	@param fTransparency
398cdf0e10cSrcweir         The transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)
399cdf0e10cSrcweir      */
400cdf0e10cSrcweir     void	setTransparency		( double fTransparency );
401cdf0e10cSrcweir     /// Set fill rule used
402cdf0e10cSrcweir     void	setFillRule			( FillRule aFillRule );
403cdf0e10cSrcweir     /** Set fill type used
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 		Currently, only one of the fill types can be used
406cdf0e10cSrcweir 		simultaneously. If you specify e.g. FillRule::fillGradient,
407cdf0e10cSrcweir 		hatching, texture and solid fill color are ignored.
408cdf0e10cSrcweir      */
409cdf0e10cSrcweir     void	setFillType			( FillType aFillType );
410cdf0e10cSrcweir     /// Set transformation applied to hatch, gradient or texture during fill
411cdf0e10cSrcweir     void	setTransform		( const Transform& pTransform );
412cdf0e10cSrcweir     /** Set state of texture tiling
413cdf0e10cSrcweir 
414cdf0e10cSrcweir     	@param bTiling
415cdf0e10cSrcweir         If set to true, texture is tiled, if set to false, texture is output only once.
416cdf0e10cSrcweir      */
417cdf0e10cSrcweir     void	setTiling			( bool bTiling = true );
418cdf0e10cSrcweir     /// Set type of hatch used
419cdf0e10cSrcweir     void	setHatchType		( HatchType aHatchType );
420cdf0e10cSrcweir     /// Set color used for drawing the hatch
421cdf0e10cSrcweir     void	setHatchColor		( Color aHatchColor );
422cdf0e10cSrcweir     /// Set type of gradient used
423cdf0e10cSrcweir     void	setGradientType		( GradientType aGradType );
424cdf0e10cSrcweir     /// Set start color of the gradient
425cdf0e10cSrcweir     void	setGradient1stColor	( Color aColor );
426cdf0e10cSrcweir     /// Set end color of the gradient
427cdf0e10cSrcweir     void	setGradient2ndColor	( Color aColor );
428cdf0e10cSrcweir     /** Set the numbers of steps to render the gradient.
429cdf0e10cSrcweir 
430cdf0e10cSrcweir         @param aCount
431cdf0e10cSrcweir         The step count. gradientStepsInfinite means use infinitely many.
432cdf0e10cSrcweir     */
433cdf0e10cSrcweir     void	setGradientStepCount( int aCount );
434cdf0e10cSrcweir     /// Set the texture graphic used
435cdf0e10cSrcweir     void	setGraphic			( const Graphic& rGraphic );
436cdf0e10cSrcweir 
437cdf0e10cSrcweir private:
438cdf0e10cSrcweir     // friends
439cdf0e10cSrcweir 	VCL_DLLPUBLIC friend SvStream& operator<<( SvStream& rOStm, const SvtGraphicFill& rClass );
440cdf0e10cSrcweir 	VCL_DLLPUBLIC friend SvStream& operator>>( SvStream& rIStm, SvtGraphicFill& rClass );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     PolyPolygon 	maPath;
443cdf0e10cSrcweir     Color			maFillColor;
444cdf0e10cSrcweir     double			mfTransparency;
445cdf0e10cSrcweir     FillRule		maFillRule;
446cdf0e10cSrcweir     FillType		maFillType;
447cdf0e10cSrcweir     Transform		maFillTransform;
448cdf0e10cSrcweir     bool			mbTiling;
449cdf0e10cSrcweir     HatchType		maHatchType;
450cdf0e10cSrcweir     Color			maHatchColor;
451cdf0e10cSrcweir     GradientType	maGradientType;
452cdf0e10cSrcweir     Color			maGradient1stColor;
453cdf0e10cSrcweir     Color			maGradient2ndColor;
454cdf0e10cSrcweir     int				maGradientStepCount;
455cdf0e10cSrcweir     Graphic			maFillGraphic;
456cdf0e10cSrcweir };
457cdf0e10cSrcweir 
458cdf0e10cSrcweir #endif /* _VCL_GRAPHICTOOLS_HXX_ */
459