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 (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 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:
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

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

Definition at line 72 of file graphictools.hxx.

Member Enumeration Documentation

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.

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::SvtGraphicStroke ( )

Definition at line 32 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 45 of file graphictools.cxx.

Member Function Documentation

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().

void SvtGraphicStroke::getDashArray ( DashArray rDashArray) const

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

Definition at line 82 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 76 of file graphictools.cxx.

References maEndArrow.

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

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().

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().

void SvtGraphicStroke::getPath ( tools::Polygon rPath) const
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 71 of file graphictools.cxx.

References maStartArrow.

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

double SvtGraphicStroke::getStrokeWidth ( ) const
inline

Get width of the stroke.

Definition at line 126 of file graphictools.hxx.

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

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().

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

Affine scaling in both X and Y dimensions.

Definition at line 102 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 97 of file graphictools.cxx.

References maEndArrow.

Referenced by MetaCommentAction::Move().

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

Set path to stroke.

Definition at line 87 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 92 of file graphictools.cxx.

References maStartArrow.

Referenced by MetaCommentAction::Move().

Friends And Related Function Documentation

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

Definition at line 138 of file graphictools.cxx.

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

Definition at line 115 of file graphictools.cxx.

Member Data Documentation

CapType SvtGraphicStroke::maCapType
private

Definition at line 180 of file graphictools.hxx.

Referenced by ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().

DashArray SvtGraphicStroke::maDashArray
private

Definition at line 183 of file graphictools.hxx.

Referenced by getDashArray(), ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().

tools::PolyPolygon SvtGraphicStroke::maEndArrow
private
JoinType SvtGraphicStroke::maJoinType
private

Definition at line 181 of file graphictools.hxx.

Referenced by ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().

tools::Polygon SvtGraphicStroke::maPath
private
tools::PolyPolygon SvtGraphicStroke::maStartArrow
private
double SvtGraphicStroke::mfMiterLimit
private

Definition at line 182 of file graphictools.hxx.

Referenced by ReadSvtGraphicStroke(), scale(), and WriteSvtGraphicStroke().

double SvtGraphicStroke::mfStrokeWidth
private

Definition at line 179 of file graphictools.hxx.

Referenced by ReadSvtGraphicStroke(), scale(), and WriteSvtGraphicStroke().

double SvtGraphicStroke::mfTransparency
private

Definition at line 178 of file graphictools.hxx.

Referenced by ReadSvtGraphicStroke(), and WriteSvtGraphicStroke().


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