Board 0.9.6
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
LibBoard::Style Struct Reference

#include <Style.h>

Public Member Functions

 Style ()
 
 Style (Color penColor, Color fillColor, double lineWidth, LineStyle linestyle, LineCap lineCap, LineJoin lineJoin)
 
std::string svgProperties (const TransformSVG &transform) const
 
std::string postscriptProperties (const TransformEPS &transform) const
 
std::string tikzProperties (const TransformTikZ &transform) const
 
Style withPenColor (const Color &color) const
 
Style withFillColor (const Color &color) const
 
Style withLineWidth (double width) const
 
Style withLineStyle (LineStyle lineStyle) const
 
Style withLineCap (LineCap lineCap) const
 
Style withLineJoin (LineJoin lineJoin) const
 

Static Public Member Functions

static void setDefaultStyle (const Style &)
 
static void setDefaultLineWidth (double)
 
static void setDefaultPenColor (Color)
 
static void setDefaultFillColor (Color)
 
static void setDefaultLineStyle (LineStyle)
 
static void setDefaultLineCap (LineCap)
 
static void setDefaultLineJoin (LineJoin)
 
static const StyledefaultStyle ()
 defaultStyle
 
static const double & defaultLineWidth ()
 defaultLineWidth
 
static const ColordefaultPenColor ()
 defaultPenColor
 
static const ColordefaultFillColor ()
 defaultFillColor
 
static const LineStyledefaultLineStyle ()
 defaultLineStyle
 
static const LineCapdefaultLineCap ()
 defaultLineCap
 
static const LineJoindefaultLineJoin ()
 defaultLineJoin
 
static void push ()
 
static void pop ()
 

Public Attributes

Color penColor
 
Color fillColor
 
double lineWidth
 
LineStyle lineStyle
 
LineCap lineCap
 
LineJoin lineJoin
 

Detailed Description

Structure describing shape style properties.

Examples
examples/interpolate.cpp, examples/line_style.cpp, and examples/rough.cpp.

Constructor & Destructor Documentation

◆ Style() [1/2]

LibBoard::Style::Style ( )

Create a style with (current) default values.

◆ Style() [2/2]

LibBoard::Style::Style ( Color  penColor,
Color  fillColor,
double  lineWidth,
LineStyle  linestyle,
LineCap  lineCap,
LineJoin  lineJoin 
)

Member Function Documentation

◆ defaultFillColor()

const Color & LibBoard::Style::defaultFillColor ( )
inlinestatic

defaultFillColor

Returns
Default fill color for shapes (initialized as Color::None)

References fillColor.

◆ defaultLineCap()

const LineCap & LibBoard::Style::defaultLineCap ( )
inlinestatic

defaultLineCap

Returns
Default line cap for shapes (initialized as ButtCap)

References lineCap.

◆ defaultLineJoin()

const LineJoin & LibBoard::Style::defaultLineJoin ( )
inlinestatic

defaultLineJoin

Returns
Default line join for shapes (initialized as MiterJoin)

References lineJoin.

◆ defaultLineStyle()

const LineStyle & LibBoard::Style::defaultLineStyle ( )
inlinestatic

defaultLineStyle

Returns
Default line style for shapes (initialized as SolidStyle)

References lineStyle.

◆ defaultLineWidth()

const double & LibBoard::Style::defaultLineWidth ( )
inlinestatic

defaultLineWidth

Returns
Default lineWidth value for shapes (intialized as 1.0).

References lineWidth.

Referenced by main().

◆ defaultPenColor()

const Color & LibBoard::Style::defaultPenColor ( )
inlinestatic

defaultPenColor

Returns
Default pen color for shapes (initialized as Black)

References penColor.

Referenced by main().

◆ defaultStyle()

const Style & LibBoard::Style::defaultStyle ( )
inlinestatic

defaultStyle

Returns
Default shape style.

Referenced by main(), and mustache().

◆ pop()

void LibBoard::Style::pop ( )
static

Restore the top of the style stack as the new default style (and pop it).

◆ postscriptProperties()

std::string LibBoard::Style::postscriptProperties ( const TransformEPS transform) const

Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.

Returns
A string of the Postscript commands.

References lineCap, lineJoin, lineStyle, lineWidth, LibBoard::TransformEPS::mapWidth(), and LibBoard::xFigDashStylesPS.

Referenced by LibBoard::Arrow::flushPostscript(), LibBoard::Bezier::flushPostscript(), LibBoard::Dot::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Line::flushPostscript(), and LibBoard::Polyline::flushPostscript().

◆ push()

void LibBoard::Style::push ( )
static

Push the current default style on top of the style stack.

◆ setDefaultFillColor()

void LibBoard::Style::setDefaultFillColor ( Color  c)
static

References fillColor.

Referenced by main(), and polygons().

◆ setDefaultLineCap()

void LibBoard::Style::setDefaultLineCap ( LineCap  lineCap)
static

References lineCap.

Referenced by main().

◆ setDefaultLineJoin()

void LibBoard::Style::setDefaultLineJoin ( LineJoin  lineJoin)
static

References lineJoin.

Referenced by main().

◆ setDefaultLineStyle()

void LibBoard::Style::setDefaultLineStyle ( LineStyle  lineStyle)
static

References lineStyle.

Referenced by main().

◆ setDefaultLineWidth()

void LibBoard::Style::setDefaultLineWidth ( double  w)
static

References lineWidth.

Referenced by ell(), hachures(), main(), and polygons().

◆ setDefaultPenColor()

void LibBoard::Style::setDefaultPenColor ( Color  c)
static

References penColor.

Referenced by main(), and polygons().

◆ setDefaultStyle()

void LibBoard::Style::setDefaultStyle ( const Style style)
static

◆ svgProperties()

std::string LibBoard::Style::svgProperties ( const TransformSVG transform) const

Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.

Returns
A string of the properties suitable for inclusion in an svg tag.

References fillColor, lineCap, lineJoin, lineStyle, lineWidth, LibBoard::TransformSVG::mapWidth(), LibBoard::Color::Null, penColor, LibBoard::SolidStyle, LibBoard::Color::svg(), LibBoard::Color::svgAlpha(), and LibBoard::xFigDashStylesSVG.

Referenced by LibBoard::Bezier::flushSVG(), LibBoard::Dot::flushSVG(), LibBoard::Ellipse::flushSVG(), LibBoard::Line::flushSVG(), and LibBoard::Polyline::flushSVG().

◆ tikzProperties()

std::string LibBoard::Style::tikzProperties ( const TransformTikZ transform) const

Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as TikZ commands.

Returns
A string of the TikZ commands.

References fillColor, lineCap, lineJoin, lineStyle, lineWidth, LibBoard::TransformSVG::mapWidth(), penColor, LibBoard::Color::tikz(), and LibBoard::xFigDashStylesTikZ.

Referenced by LibBoard::Arrow::flushTikZ(), LibBoard::Ellipse::flushTikZ(), LibBoard::Line::flushTikZ(), LibBoard::Polyline::flushTikZ(), and LibBoard::Text::flushTikZ().

◆ withFillColor()

Style LibBoard::Style::withFillColor ( const Color color) const
inline

Returns a copy of the style, with modified fill color.

Parameters
colorNew fill color.
Returns
A copy of the style, with modified fill color.

References fillColor.

◆ withLineCap()

Style LibBoard::Style::withLineCap ( LineCap  lineCap) const
inline

Returns a copy of the style, with modified line cap.

Parameters
lineCapNew line cap.
Returns
A copy of the style, with modified line cap.

References lineCap.

◆ withLineJoin()

Style LibBoard::Style::withLineJoin ( LineJoin  lineJoin) const
inline

Returns a copy of the style, with modified line join.

Parameters
lineJoinNew line join.
Returns
A copy of the style, with modified line join.

References lineJoin.

◆ withLineStyle()

Style LibBoard::Style::withLineStyle ( LineStyle  lineStyle) const
inline

Returns a copy of the style, with modified line style.

Parameters
lineStyleNew line style.
Returns
A copy of the style, with modified line style.
Examples
examples/line_style.cpp.

References lineStyle.

Referenced by main().

◆ withLineWidth()

Style LibBoard::Style::withLineWidth ( double  width) const
inline

Returns a copy of the style, with modified line width.

Parameters
widthNew line width.
Returns
A copy of the style, with modified line width.

References lineWidth.

◆ withPenColor()

Style LibBoard::Style::withPenColor ( const Color color) const
inline

Returns a copy of the style, with modified pen color.

Parameters
colorNew pen color.
Returns
A copy of the style, with modified pen color.

References penColor.

Member Data Documentation

◆ fillColor

Color LibBoard::Style::fillColor

◆ lineCap

LineCap LibBoard::Style::lineCap

◆ lineJoin

LineJoin LibBoard::Style::lineJoin

◆ lineStyle

LineStyle LibBoard::Style::lineStyle

◆ lineWidth

double LibBoard::Style::lineWidth

◆ penColor

Color LibBoard::Style::penColor

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