LibreOffice Module vcl (master) 1
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
SvtGraphicStroke Class Reference

Encapsulates geometry and associated attributes of a graphical 'pen stroke'. More...

#include <graphictools.hxx>

Collaboration diagram for SvtGraphicStroke:
[legend]

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 (tools::Polygon aPath, tools::PolyPolygon aStartArrow, tools::PolyPolygon aEndArrow, double fTransparency, double fStrokeWidth, CapType aCap, JoinType aJoin, double fMiterLimit, 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 SvStreamWriteSvtGraphicStroke (SvStream &rOStm, const SvtGraphicStroke &rClass)
 
VCL_DLLPUBLIC friend SvStreamReadSvtGraphicStroke (SvStream &rIStm, SvtGraphicStroke &rClass)
 

Detailed Description

Encapsulates geometry and associated attributes of a graphical 'pen stroke'.

Attention: \n Widespread use is deprecated. See declarations above
for the way to go. Especially the copied enums from svx/xenum.hxx are troublesome.

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.

Member Typedef Documentation

◆ DashArray

typedef ::std::vector< double > SvtGraphicStroke::DashArray

Definition at line 72 of file graphictools.hxx.

Member Enumeration Documentation

◆ CapType

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.

◆ JoinType

Style for joins of individual stroke segments.

Enumerator
joinMiter 

Extend segment edges, until they cross.

joinRound 

Connect segments by a filled round arc.

joinBevel 

Connect segments by a direct straight line.

joinNone 

Perform no join, leads to visible gaps between thick line segments.

Definition at line 61 of file graphictools.hxx.

Constructor & Destructor Documentation

◆ SvtGraphicStroke() [1/2]

SvtGraphicStroke::SvtGraphicStroke ( )

Definition at line 32 of file graphictools.cxx.

◆ SvtGraphicStroke() [2/2]

SvtGraphicStroke::SvtGraphicStroke ( tools::Polygon  aPath,
tools::PolyPolygon  aStartArrow,
tools::PolyPolygon  aEndArrow,
double  fTransparency,
double  fStrokeWidth,
CapType  aCap,
JoinType  aJoin,
double  fMiterLimit,
DashArray &&  rDashArray 
)

All in one constructor.

See accessor method descriptions for argument description

Definition at line 41 of file graphictools.cxx.

References maPath.

Member Function Documentation

◆ getCapType()

CapType SvtGraphicStroke::getCapType ( ) const
inline

Get the style in which open stroke ends are drawn.

Definition at line 128 of file graphictools.hxx.

Referenced by vcl::PDFWriterImpl::playMetafile().

◆ getDashArray()

void SvtGraphicStroke::getDashArray ( DashArray rDashArray) const

Get an array of "on" and "off" lengths for stroke dashing.

Definition at line 78 of file graphictools.cxx.

References maDashArray.

Referenced by vcl::PDFWriterImpl::playMetafile().

◆ getEndArrow()

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 72 of file graphictools.cxx.

References maEndArrow.

Referenced by MetaCommentAction::Move(), and vcl::PDFWriterImpl::playMetafile().

◆ getJoinType()

JoinType SvtGraphicStroke::getJoinType ( ) const
inline

Get the style in which the stroke segments are joined.

Definition at line 130 of file graphictools.hxx.

Referenced by vcl::PDFWriterImpl::playMetafile().

◆ getMiterLimit()

double SvtGraphicStroke::getMiterLimit ( ) const
inline

Get the maximum length of mitered joins.

Definition at line 132 of file graphictools.hxx.

Referenced by vcl::PDFWriterImpl::playMetafile().

◆ getPath()

void SvtGraphicStroke::getPath ( tools::Polygon rPath) const

◆ getStartArrow()

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 67 of file graphictools.cxx.

References maStartArrow.

Referenced by MetaCommentAction::Move(), and vcl::PDFWriterImpl::playMetafile().

◆ getStrokeWidth()

double SvtGraphicStroke::getStrokeWidth ( ) const
inline

Get width of the stroke.

Definition at line 126 of file graphictools.hxx.

Referenced by vcl::PDFWriterImpl::playMetafile().

◆ getTransparency()

double SvtGraphicStroke::getTransparency ( ) const
inline

Get stroke transparency.

Returns
the transparency, ranging from 0.0 (opaque) to 1.0 (fully translucent)

Definition at line 124 of file graphictools.hxx.

Referenced by vcl::PDFWriterImpl::playMetafile().

◆ scale()

void SvtGraphicStroke::scale ( double  fScaleX,
double  fScaleY 
)

Affine scaling in both X and Y dimensions.

Definition at line 98 of file graphictools.cxx.

References maEndArrow, maPath, maStartArrow, mfMiterLimit, mfStrokeWidth, tools::Polygon::Scale(), and tools::PolyPolygon::Scale().

Referenced by MetaCommentAction::Scale().

◆ setEndArrow()

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 93 of file graphictools.cxx.

References maEndArrow.

Referenced by MetaCommentAction::Move().

◆ setPath()

void SvtGraphicStroke::setPath ( const tools::Polygon rPoly)

Set path to stroke.

Definition at line 83 of file graphictools.cxx.

References maPath.

Referenced by clipMetafileContentAgainstOwnRegions(), MetaCommentAction::Move(), and GDIMetaFile::Rotate().

◆ setStartArrow()

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 88 of file graphictools.cxx.

References maStartArrow.

Referenced by MetaCommentAction::Move().

Friends And Related Function Documentation

◆ ReadSvtGraphicStroke

VCL_DLLPUBLIC friend SvStream & ReadSvtGraphicStroke ( SvStream rIStm,
SvtGraphicStroke rClass 
)
friend

Definition at line 134 of file graphictools.cxx.

◆ WriteSvtGraphicStroke

VCL_DLLPUBLIC friend SvStream & WriteSvtGraphicStroke ( SvStream rOStm,
const SvtGraphicStroke rClass 
)
friend

Definition at line 111 of file graphictools.cxx.

Member Data Documentation

◆ maCapType

CapType SvtGraphicStroke::maCapType
private

Definition at line 180 of file graphictools.hxx.

◆ maDashArray

DashArray SvtGraphicStroke::maDashArray
private

Definition at line 183 of file graphictools.hxx.

Referenced by getDashArray().

◆ maEndArrow

tools::PolyPolygon SvtGraphicStroke::maEndArrow
private

Definition at line 177 of file graphictools.hxx.

Referenced by getEndArrow(), scale(), and setEndArrow().

◆ maJoinType

JoinType SvtGraphicStroke::maJoinType
private

Definition at line 181 of file graphictools.hxx.

◆ maPath

tools::Polygon SvtGraphicStroke::maPath
private

Definition at line 175 of file graphictools.hxx.

Referenced by getPath(), scale(), and setPath().

◆ maStartArrow

tools::PolyPolygon SvtGraphicStroke::maStartArrow
private

Definition at line 176 of file graphictools.hxx.

Referenced by getStartArrow(), scale(), and setStartArrow().

◆ mfMiterLimit

double SvtGraphicStroke::mfMiterLimit
private

Definition at line 182 of file graphictools.hxx.

Referenced by scale().

◆ mfStrokeWidth

double SvtGraphicStroke::mfStrokeWidth
private

Definition at line 179 of file graphictools.hxx.

Referenced by scale().

◆ mfTransparency

double SvtGraphicStroke::mfTransparency
private

Definition at line 178 of file graphictools.hxx.


The documentation for this class was generated from the following files: