LibreOffice Module vcl (master)
1
|
Encapsulates geometry and associated attributes of a graphical 'pen stroke'. More...
#include <graphictools.hxx>
Public Types | |
enum | CapType { capButt =0, capRound, capSquare } |
Style for open stroke ends. More... | |
enum | JoinType { joinMiter =0, joinRound, joinBevel, joinNone } |
Style for joins of individual stroke segments. More... | |
typedef ::std::vector< double > | DashArray |
Public Member Functions | |
SvtGraphicStroke () | |
SvtGraphicStroke (const tools::Polygon &rPath, const tools::PolyPolygon &rStartArrow, const tools::PolyPolygon &rEndArrow, double fTransparency, double fStrokeWidth, CapType aCap, JoinType aJoin, double fMiterLimit, const DashArray &rDashArray) | |
All in one constructor. More... | |
void | getPath (tools::Polygon &) const |
Query path to stroke. More... | |
void | getStartArrow (tools::PolyPolygon &) const |
Get the polygon that is put at the start of the line. More... | |
void | getEndArrow (tools::PolyPolygon &) const |
Get the polygon that is put at the end of the line. More... | |
double | getTransparency () const |
Get stroke transparency. More... | |
double | getStrokeWidth () const |
Get width of the stroke. More... | |
CapType | getCapType () const |
Get the style in which open stroke ends are drawn. More... | |
JoinType | getJoinType () const |
Get the style in which the stroke segments are joined. More... | |
double | getMiterLimit () const |
Get the maximum length of mitered joins. More... | |
void | getDashArray (DashArray &) const |
Get an array of "on" and "off" lengths for stroke dashing. More... | |
void | setPath (const tools::Polygon &) |
Set path to stroke. More... | |
void | setStartArrow (const tools::PolyPolygon &) |
Set the polygon that is put at the start of the line. More... | |
void | setEndArrow (const tools::PolyPolygon &) |
Set the polygon that is put at the end of the line. More... | |
void | scale (double fScaleX, double fScaleY) |
Affine scaling in both X and Y dimensions. More... | |
Private Attributes | |
tools::Polygon | maPath |
tools::PolyPolygon | maStartArrow |
tools::PolyPolygon | maEndArrow |
double | mfTransparency |
double | mfStrokeWidth |
CapType | maCapType |
JoinType | maJoinType |
double | mfMiterLimit |
DashArray | maDashArray |
Friends | |
VCL_DLLPUBLIC friend SvStream & | WriteSvtGraphicStroke (SvStream &rOStm, const SvtGraphicStroke &rClass) |
VCL_DLLPUBLIC friend SvStream & | ReadSvtGraphicStroke (SvStream &rIStm, SvtGraphicStroke &rClass) |
Encapsulates geometry and associated attributes of a graphical 'pen stroke'.
Use this class to store geometry and attributes of a graphical 'pen stroke', such as pen width, dashing etc. The geometry is the so-called 'path' along which the stroke is traced, with the given pen width. The cap type determines how the open ends of the path should be drawn. If the geometry consists of more than one segment, the join type determines in which way the segments are joined.
Definition at line 47 of file graphictools.hxx.
typedef ::std::vector< double > SvtGraphicStroke::DashArray |
Definition at line 72 of file graphictools.hxx.
Style for open stroke ends.
Enumerator | |
---|---|
capButt |
No additional cap. |
capRound |
Half-round cap at the line end, the center lying at the end point. |
capSquare |
Half-square cap at the line end, the center lying at the end point. |
Definition at line 51 of file graphictools.hxx.
Style for joins of individual stroke segments.
Definition at line 61 of file graphictools.hxx.
SvtGraphicStroke::SvtGraphicStroke | ( | ) |
Definition at line 31 of file graphictools.cxx.
SvtGraphicStroke::SvtGraphicStroke | ( | const tools::Polygon & | rPath, |
const tools::PolyPolygon & | rStartArrow, | ||
const tools::PolyPolygon & | rEndArrow, | ||
double | fTransparency, | ||
double | fStrokeWidth, | ||
CapType | aCap, | ||
JoinType | aJoin, | ||
double | fMiterLimit, | ||
const DashArray & | rDashArray | ||
) |
All in one constructor.
See accessor method descriptions for argument description
Definition at line 44 of file graphictools.cxx.
References maPath.
|
inline |
Get the style in which open stroke ends are drawn.
Definition at line 128 of file graphictools.hxx.
Referenced by vcl::PDFWriterImpl::playMetafile().
Get an array of "on" and "off" lengths for stroke dashing.
Definition at line 81 of file graphictools.cxx.
References maDashArray.
Referenced by vcl::PDFWriterImpl::playMetafile().
void SvtGraphicStroke::getEndArrow | ( | tools::PolyPolygon & | rPath | ) | const |
Get the polygon that is put at the end of the line.
The polygon is in a special normalized position, and already scaled to the desired size: the center of the stroked path will meet the given polygon at (0,0) from negative y values. Thus, an arrow would have its baseline on the x axis, going upwards to positive y values. Furthermore, the polygon is also scaled in a special way: the width of the joining stroke is defined to be SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. So, if the arrow does have this width, it has to fit every stroke with every stroke width exactly.
Definition at line 75 of file graphictools.cxx.
References maEndArrow.
Referenced by MetaCommentAction::Move(), and vcl::PDFWriterImpl::playMetafile().
|
inline |
Get the style in which the stroke segments are joined.
Definition at line 130 of file graphictools.hxx.
Referenced by vcl::PDFWriterImpl::playMetafile().
|
inline |
Get the maximum length of mitered joins.
Definition at line 132 of file graphictools.hxx.
Referenced by vcl::PDFWriterImpl::playMetafile().
void SvtGraphicStroke::getPath | ( | tools::Polygon & | rPath | ) | const |
Query path to stroke.
Definition at line 65 of file graphictools.cxx.
References maPath.
Referenced by clipMetafileContentAgainstOwnRegions(), MetaCommentAction::Move(), vcl::PDFWriterImpl::playMetafile(), and GDIMetaFile::Rotate().
void SvtGraphicStroke::getStartArrow | ( | tools::PolyPolygon & | rPath | ) | const |
Get the polygon that is put at the start of the line.
The polygon is in a special normalized position: the center of the stroked path will meet the given polygon at (0,0) from negative y values. Thus, an arrow would have its baseline on the x axis, going upwards to positive y values. Furthermore, the polygon is also scaled in a special way: the width of the joining stroke is defined to be SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. So, if the arrow does have this width, it has to fit every stroke with every stroke width exactly.
Definition at line 70 of file graphictools.cxx.
References maStartArrow.
Referenced by MetaCommentAction::Move(), and vcl::PDFWriterImpl::playMetafile().
|
inline |
Get width of the stroke.
Definition at line 126 of file graphictools.hxx.
Referenced by vcl::PDFWriterImpl::playMetafile().
|
inline |
Get stroke transparency.
Definition at line 124 of file graphictools.hxx.
Referenced by vcl::PDFWriterImpl::playMetafile().
void SvtGraphicStroke::scale | ( | double | fScaleX, |
double | fScaleY | ||
) |
Affine scaling in both X and Y dimensions.
Definition at line 101 of file graphictools.cxx.
References maEndArrow, maPath, maStartArrow, mfMiterLimit, mfStrokeWidth, tools::Polygon::Scale(), and tools::PolyPolygon::Scale().
Referenced by MetaCommentAction::Scale().
void SvtGraphicStroke::setEndArrow | ( | const tools::PolyPolygon & | rPoly | ) |
Set the polygon that is put at the end of the line.
The polygon has to be in a special normalized position, and already scaled to the desired size: the center of the stroked path will meet the given polygon at (0,0) from negative y values. Thus, an arrow would have its baseline on the x axis, going upwards to positive y values. Furthermore, the polygon also has to be scaled appropriately: the width of the joining stroke is defined to be SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your arrow does have this width, it will fit every stroke with every stroke width exactly.
Definition at line 96 of file graphictools.cxx.
References maEndArrow.
Referenced by MetaCommentAction::Move().
void SvtGraphicStroke::setPath | ( | const tools::Polygon & | rPoly | ) |
Set path to stroke.
Definition at line 86 of file graphictools.cxx.
References maPath.
Referenced by clipMetafileContentAgainstOwnRegions(), MetaCommentAction::Move(), and GDIMetaFile::Rotate().
void SvtGraphicStroke::setStartArrow | ( | const tools::PolyPolygon & | rPoly | ) |
Set the polygon that is put at the start of the line.
The polygon has to be in a special normalized position, and already scaled to the desired size: the center of the stroked path will meet the given polygon at (0,0) from negative y values. Thus, an arrow would have its baseline on the x axis, going upwards to positive y values. Furthermore, the polygon also has to be scaled appropriately: the width of the joining stroke is defined to be SvtGraphicStroke::normalizedArrowWidth (0x10000), i.e. ranging from x=-0x8000 to x=0x8000. If your arrow does have this width, it will fit every stroke with every stroke width exactly.
Definition at line 91 of file graphictools.cxx.
References maStartArrow.
Referenced by MetaCommentAction::Move().
|
friend |
Definition at line 137 of file graphictools.cxx.
|
friend |
Definition at line 114 of file graphictools.cxx.
|
private |
Definition at line 180 of file graphictools.hxx.
Referenced by ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().
|
private |
Definition at line 183 of file graphictools.hxx.
Referenced by getDashArray(), ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().
|
private |
Definition at line 177 of file graphictools.hxx.
Referenced by getEndArrow(), ReadSvtGraphicStroke(), scale(), setEndArrow(), and WriteSvtGraphicStroke().
|
private |
Definition at line 181 of file graphictools.hxx.
Referenced by ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().
|
private |
Definition at line 175 of file graphictools.hxx.
Referenced by getPath(), ReadSvtGraphicStroke(), scale(), setPath(), and WriteSvtGraphicStroke().
|
private |
Definition at line 176 of file graphictools.hxx.
Referenced by getStartArrow(), ReadSvtGraphicStroke(), scale(), setStartArrow(), and WriteSvtGraphicStroke().
|
private |
Definition at line 182 of file graphictools.hxx.
Referenced by ReadSvtGraphicStroke(), scale(), and WriteSvtGraphicStroke().
|
private |
Definition at line 179 of file graphictools.hxx.
Referenced by ReadSvtGraphicStroke(), scale(), and WriteSvtGraphicStroke().
|
private |
Definition at line 178 of file graphictools.hxx.
Referenced by ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().