LibreOffice Module vcl (master)  1
graphictools.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_GRAPHICTOOLS_HXX
21 #define INCLUDED_VCL_GRAPHICTOOLS_HXX
22 
23 #include <vcl/dllapi.h>
24 #include <sal/types.h>
25 #include <tools/color.hxx>
26 #include <tools/poly.hxx>
27 #include <vcl/graph.hxx>
28 
29 #include <vector>
30 
31 class SvStream;
32 
48 {
49 public:
51  enum CapType
52  {
54  capButt=0,
58  capSquare
59  };
61  enum JoinType
62  {
64  joinMiter=0,
70  joinNone
71  };
72  typedef ::std::vector< double > DashArray;
73 
79  SvtGraphicStroke( const tools::Polygon& rPath,
80  const tools::PolyPolygon& rStartArrow,
81  const tools::PolyPolygon& rEndArrow,
82  double fTransparency,
83  double fStrokeWidth,
84  CapType aCap,
85  JoinType aJoin,
86  double fMiterLimit,
87  const DashArray& rDashArray ); // TODO: Dash array offset (position where to start, see PS)
88 
89  // accessors
91  void getPath ( tools::Polygon& ) const;
105  void getStartArrow ( tools::PolyPolygon& ) const;
119  void getEndArrow ( tools::PolyPolygon& ) const;
124  double getTransparency () const { return mfTransparency;}
126  double getStrokeWidth () const { return mfStrokeWidth;}
128  CapType getCapType () const { return maCapType;}
130  JoinType getJoinType () const { return maJoinType;}
132  double getMiterLimit () const { return mfMiterLimit;}
134  void getDashArray ( DashArray& ) const;
135 
136  // mutators
138  void setPath ( const tools::Polygon& );
152  void setStartArrow ( const tools::PolyPolygon& );
166  void setEndArrow ( const tools::PolyPolygon& );
168  void scale ( double fScaleX, double fScaleY );
169 
170 private:
171  // friends
172  VCL_DLLPUBLIC friend SvStream& WriteSvtGraphicStroke( SvStream& rOStm, const SvtGraphicStroke& rClass );
174 
182  double mfMiterLimit;
183  DashArray maDashArray;
184 };
185 
200 {
201 public:
203  enum FillRule
204  {
214  fillNonZero=0,
221  fillEvenOdd
222  };
224  enum FillType
225  {
227  fillSolid=0,
233  fillTexture
234  };
237  {
239  hatchSingle=0,
246  hatchTriple
247  };
249  enum class GradientType {Linear, Radial, Rectangular};
251  enum { gradientStepsInfinite=0 };
267  {
268  enum { MatrixSize=6 };
269  Transform();
270  double matrix[MatrixSize];
271  };
272 
273  SvtGraphicFill();
278  SvtGraphicFill( const tools::PolyPolygon& rPath,
279  Color aFillColor,
280  double fTransparency,
281  FillRule aFillRule,
282  FillType aFillType, // TODO: Multitexturing
283  const Transform& aFillTransform,
284  bool bTiling,
285  HatchType aHatchType, // TODO: vector of directions and start points
286  Color aHatchColor,
287  GradientType aGradientType, // TODO: Transparent gradients (orthogonal to normal ones)
288  Color aGradient1stColor, // TODO: vector of colors and offsets
289  Color aGradient2ndColor,
290  sal_Int32 aGradientStepCount, // numbers of steps to render the gradient. gradientStepsInfinite means infinitely many.
291  const Graphic& aFillGraphic );
292 
293  // accessors
295  void getPath ( tools::PolyPolygon& ) const;
297  const Color& getFillColor () const { return maFillColor;}
302  double getTransparency () const { return mfTransparency;}
304  FillRule getFillRule () const { return maFillRule;}
311  FillType getFillType () const { return maFillType;}
323  void getTransform ( Transform& ) const;
325  bool IsTiling () const { return mbTiling;}
330  bool isTiling () const { return mbTiling;}
332  GradientType getGradientType () const { return maGradientType;}
333 
341  void getGraphic ( Graphic& ) const;
342 
343  // mutators
345  void setPath ( const tools::PolyPolygon& rPath );
346 
347 private:
348  // friends
349  VCL_DLLPUBLIC friend SvStream& WriteSvtGraphicFill( SvStream& rOStm, const SvtGraphicFill& rClass );
351 
358  bool mbTiling;
366 };
367 
368 #endif // INCLUDED_VCL_GRAPHICTOOLS_HXX
369 
370 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Color & getFillColor() const
Get color used for solid fills.
CapType
Style for open stroke ends.
GradientType getGradientType() const
Get type of gradient used.
Color maGradient1stColor
SvStream & WriteSvtGraphicStroke(SvStream &rOStm, const SvtGraphicStroke &rClass)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
Connect segments by a filled round arc.
Encapsulates geometry and associated attributes of a graphical 'pen stroke'.
FillRule
Type of fill algorithm used.
DashArray maDashArray
FillType
Type of filling used.
GradientType
Type of gradient used.
HatchType
Type of hatching used.
SvStream & ReadSvtGraphicStroke(SvStream &rIStm, SvtGraphicStroke &rClass)
SvStream & ReadSvtGraphicFill(SvStream &rIStm, SvtGraphicFill &rClass)
CapType getCapType() const
Get the style in which open stroke ends are drawn.
Fill with the specified gradient.
void Transform(void *pInputStream, void *pOutputStream, long nAngle)
Definition: jpegc.cxx:444
double getTransparency() const
Get stroke transparency.
double getMiterLimit() const
Get the maximum length of mitered joins.
HatchType maHatchType
horizontal and vertical orthogonally crossing lines, one unit apart
GradientType maGradientType
Fill with the specified hatch.
tools::PolyPolygon maPath
Transform maFillTransform
tools::Polygon maPath
FillType getFillType() const
Get fill type used.
SvStream & WriteSvtGraphicFill(SvStream &rOStm, const SvtGraphicFill &rClass)
uno::Sequence< double > maFillColor
sal_Int32 maGradientStepCount
tools::PolyPolygon maEndArrow
bool isTiling() const
Query state of texture tiling.
FillType maFillType
Connect segments by a direct straight line.
JoinType
Style for joins of individual stroke segments.
::std::vector< double > DashArray
Color maGradient2ndColor
FillRule maFillRule
double getTransparency() const
Get stroke transparency.
Half-round cap at the line end, the center lying at the end point.
Graphic maFillGraphic
double getStrokeWidth() const
Get width of the stroke.
bool IsTiling() const
deprecated
FillRule getFillRule() const
Get fill rule used.
JoinType getJoinType() const
Get the style in which the stroke segments are joined.
Encapsulates geometry and associated attributes of a filled area.
tools::PolyPolygon maStartArrow
Homogeneous 2D transformation matrix.