bpp-core3  3.0.0
bpp::AbstractGraphicDevice Class Referenceabstract

Partial implementation of the GraphicDevice interface. More...

#include <Bpp/Graphics/AbstractGraphicDevice.h>

+ Inheritance diagram for bpp::AbstractGraphicDevice:
+ Collaboration diagram for bpp::AbstractGraphicDevice:

Public Member Functions

 AbstractGraphicDevice ()
 
virtual ~AbstractGraphicDevice ()
 
void setXUnit (double xu)
 
void setYUnit (double yu)
 
double getXUnit () const
 
double getYUnit () const
 
void setCurrentForegroundColor (const RGBColor &color)
 
void setCurrentBackgroundColor (const RGBColor &color)
 
void setCurrentFont (const Font &font)
 
void setCurrentPointSize (unsigned int size)
 
void setCurrentLineType (short type)
 
void setCurrentLayer (int layerIndex)
 
const RGBColorgetCurrentForegroundColor () const
 
const RGBColorgetCurrentBackgroundColor () const
 
const FontgetCurrentFont () const
 
unsigned int getCurrentPointSize () const
 
short getCurrentLineType () const
 
int getCurrentLayer () const
 
virtual void begin ()=0
 Start the painting. More...
 
virtual void end ()=0
 End the painting. More...
 
virtual void drawLine (double x1, double y1, double x2, double y2)=0
 Draw a line between two points. More...
 
virtual void drawRect (double x, double y, double width, double height, short fill=FILL_EMPTY)=0
 Draw a rectangle. More...
 
virtual void drawCircle (double x, double y, double radius, short fill=FILL_EMPTY)=0
 Draw a circle. More...
 
virtual void drawText (double x, double y, const std::string &text, short hpos=TEXT_HORIZONTAL_LEFT, short vpos=TEXT_VERTICAL_BOTTOM, double angle=0)=0
 Draw some characters. More...
 
virtual void comment (const std::string &comment)=0
 Add a comment in the output. More...
 

Static Public Attributes

static short TEXT_HORIZONTAL_CENTER = 0
 
static short TEXT_HORIZONTAL_LEFT = 1
 
static short TEXT_HORIZONTAL_RIGHT = 2
 
static short TEXT_VERTICAL_CENTER = 3
 
static short TEXT_VERTICAL_BOTTOM = 4
 
static short TEXT_VERTICAL_TOP = 5
 
static short FILL_EMPTY = 10
 
static short FILL_FILLED = 11
 
static short FILL_PATTERN = 12
 
static short LINE_SOLID = 20
 
static short LINE_DASHED = 21
 
static short LINE_DOTTED = 22
 

Protected Member Functions

double x_ (double x) const
 
double y_ (double y) const
 
double revx_ (double x) const
 
double revy_ (double y) const
 

Private Attributes

double xUnit_
 
double yUnit_
 
RGBColor fgColor_
 
RGBColor bgColor_
 
Font font_
 
unsigned int pointSize_
 
short lineType_
 
int currentLayer_
 

Detailed Description

Partial implementation of the GraphicDevice interface.

Implement this interface to support new formats.

Definition at line 18 of file AbstractGraphicDevice.h.

Constructor & Destructor Documentation

◆ AbstractGraphicDevice()

bpp::AbstractGraphicDevice::AbstractGraphicDevice ( )
inline

Definition at line 32 of file AbstractGraphicDevice.h.

◆ ~AbstractGraphicDevice()

virtual bpp::AbstractGraphicDevice::~AbstractGraphicDevice ( )
inlinevirtual

Definition at line 36 of file AbstractGraphicDevice.h.

Member Function Documentation

◆ begin()

virtual void bpp::GraphicDevice::begin ( )
pure virtualinherited

Start the painting.

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ comment()

virtual void bpp::GraphicDevice::comment ( const std::string &  comment)
pure virtualinherited

Add a comment in the output.

Parameters
commentComment text.

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ drawCircle()

virtual void bpp::GraphicDevice::drawCircle ( double  x,
double  y,
double  radius,
short  fill = FILL_EMPTY 
)
pure virtualinherited

Draw a circle.

This method uses the current foreground color and the current line type for drawing the stroke of the circle, and the current background color for filling the circle.

Parameters
xx coordinate of the center
yy coordinate of the center
radiusThe circle radius
fillFilling type (one of FILL_EMPTY, FILL_FILLED or FILL_PATTERN).

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ drawLine()

virtual void bpp::GraphicDevice::drawLine ( double  x1,
double  y1,
double  x2,
double  y2 
)
pure virtualinherited

Draw a line between two points.

This method uses the current foreground color and the current line type.

Parameters
x1x coordinate 1
y1y coordinate 1
x2x coordinate 2
y2y coordinate 2

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ drawRect()

virtual void bpp::GraphicDevice::drawRect ( double  x,
double  y,
double  width,
double  height,
short  fill = FILL_EMPTY 
)
pure virtualinherited

Draw a rectangle.

This method uses the current foreground color and the current line type for drawing the stroke of the rectangle, and the current background color for filling the rectangle.

Parameters
xx coordinate
yy coordinate
widthThe rectangle width
heightThe rectangle height
fillFilling type (one of FILL_EMPTY, FILL_FILLED or FILL_PATTERN).

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ drawText()

virtual void bpp::GraphicDevice::drawText ( double  x,
double  y,
const std::string &  text,
short  hpos = TEXT_HORIZONTAL_LEFT,
short  vpos = TEXT_VERTICAL_BOTTOM,
double  angle = 0 
)
pure virtualinherited

Draw some characters.

This method uses the current foreground color.

Parameters
xx coordinate
yy coordinate
textThe characters to draw
hposHorizontal adjustment, one of TEXT_HORIZONTAL_LEFT, TEXT_HORIZONTAL_CENTER or TEXT_HORIZONTAL_RIGHT.
vposVertical adjustment, one of TEXT_VERTICAL_LEFT, TEXT_VERTICAL_CENTER or TEXT_VERTICAL_RIGHT.
angleAngle i radian to rotate the text.

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ end()

virtual void bpp::GraphicDevice::end ( )
pure virtualinherited

End the painting.

Depending on the implementation of the device, the call of this method might be required before the plotting commands become visible.

Implemented in bpp::XFigGraphicDevice, bpp::PgfGraphicDevice, and bpp::SvgGraphicDevice.

◆ getCurrentBackgroundColor()

const RGBColor& bpp::AbstractGraphicDevice::getCurrentBackgroundColor ( ) const
inlinevirtual

Implements bpp::GraphicDevice.

Definition at line 58 of file AbstractGraphicDevice.h.

References bgColor_.

◆ getCurrentFont()

const Font& bpp::AbstractGraphicDevice::getCurrentFont ( ) const
inlinevirtual

Implements bpp::GraphicDevice.

Definition at line 59 of file AbstractGraphicDevice.h.

References font_.

◆ getCurrentForegroundColor()

const RGBColor& bpp::AbstractGraphicDevice::getCurrentForegroundColor ( ) const
inlinevirtual

Implements bpp::GraphicDevice.

Definition at line 57 of file AbstractGraphicDevice.h.

References fgColor_.

◆ getCurrentLayer()

int bpp::AbstractGraphicDevice::getCurrentLayer ( ) const
inlinevirtual

◆ getCurrentLineType()

short bpp::AbstractGraphicDevice::getCurrentLineType ( ) const
inlinevirtual

Implements bpp::GraphicDevice.

Definition at line 61 of file AbstractGraphicDevice.h.

References lineType_.

◆ getCurrentPointSize()

unsigned int bpp::AbstractGraphicDevice::getCurrentPointSize ( ) const
inlinevirtual

Implements bpp::GraphicDevice.

Definition at line 60 of file AbstractGraphicDevice.h.

References pointSize_.

Referenced by bpp::PgfGraphicDevice::setCurrentLineType().

◆ getXUnit()

double bpp::AbstractGraphicDevice::getXUnit ( ) const
inlinevirtual
Returns
The x expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 41 of file AbstractGraphicDevice.h.

References xUnit_.

Referenced by bpp::PgfGraphicDevice::end().

◆ getYUnit()

double bpp::AbstractGraphicDevice::getYUnit ( ) const
inlinevirtual
Returns
The y expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 42 of file AbstractGraphicDevice.h.

References yUnit_.

Referenced by bpp::PgfGraphicDevice::end().

◆ revx_()

double bpp::AbstractGraphicDevice::revx_ ( double  x) const
inlineprotected

Definition at line 68 of file AbstractGraphicDevice.h.

References xUnit_.

◆ revy_()

double bpp::AbstractGraphicDevice::revy_ ( double  y) const
inlineprotected

Definition at line 69 of file AbstractGraphicDevice.h.

References yUnit_.

◆ setCurrentBackgroundColor()

void bpp::AbstractGraphicDevice::setCurrentBackgroundColor ( const RGBColor color)
inlinevirtual

◆ setCurrentFont()

void bpp::AbstractGraphicDevice::setCurrentFont ( const Font font)
inlinevirtual

◆ setCurrentForegroundColor()

void bpp::AbstractGraphicDevice::setCurrentForegroundColor ( const RGBColor color)
inlinevirtual

◆ setCurrentLayer()

void bpp::AbstractGraphicDevice::setCurrentLayer ( int  layerIndex)
inlinevirtual

◆ setCurrentLineType()

void bpp::AbstractGraphicDevice::setCurrentLineType ( short  type)
inlinevirtual

◆ setCurrentPointSize()

void bpp::AbstractGraphicDevice::setCurrentPointSize ( unsigned int  size)
inlinevirtual

Implements bpp::GraphicDevice.

Reimplemented in bpp::PgfGraphicDevice.

Definition at line 47 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::setCurrentPointSize().

◆ setXUnit()

void bpp::AbstractGraphicDevice::setXUnit ( double  xu)
inlinevirtual
Parameters
xuThe x expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 39 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::PgfGraphicDevice().

◆ setYUnit()

void bpp::AbstractGraphicDevice::setYUnit ( double  yu)
inlinevirtual
Parameters
yuThe y expansion factor. The actual unit actually depends on the implementation.

Implements bpp::GraphicDevice.

Definition at line 40 of file AbstractGraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::PgfGraphicDevice().

◆ x_()

double bpp::AbstractGraphicDevice::x_ ( double  x) const
inlineprotected

◆ y_()

double bpp::AbstractGraphicDevice::y_ ( double  y) const
inlineprotected

Definition at line 66 of file AbstractGraphicDevice.h.

References yUnit_.

Member Data Documentation

◆ bgColor_

RGBColor bpp::AbstractGraphicDevice::bgColor_
private

Definition at line 25 of file AbstractGraphicDevice.h.

Referenced by getCurrentBackgroundColor().

◆ currentLayer_

int bpp::AbstractGraphicDevice::currentLayer_
private

Definition at line 29 of file AbstractGraphicDevice.h.

Referenced by getCurrentLayer().

◆ fgColor_

RGBColor bpp::AbstractGraphicDevice::fgColor_
private

Definition at line 24 of file AbstractGraphicDevice.h.

Referenced by getCurrentForegroundColor().

◆ FILL_EMPTY

short GraphicDevice::FILL_EMPTY = 10
staticinherited

◆ FILL_FILLED

short GraphicDevice::FILL_FILLED = 11
staticinherited

◆ FILL_PATTERN

short GraphicDevice::FILL_PATTERN = 12
staticinherited

Definition at line 152 of file GraphicDevice.h.

◆ font_

Font bpp::AbstractGraphicDevice::font_
private

Definition at line 26 of file AbstractGraphicDevice.h.

Referenced by getCurrentFont().

◆ LINE_DASHED

short GraphicDevice::LINE_DASHED = 21
staticinherited

◆ LINE_DOTTED

short GraphicDevice::LINE_DOTTED = 22
staticinherited

◆ LINE_SOLID

short GraphicDevice::LINE_SOLID = 20
staticinherited

◆ lineType_

short bpp::AbstractGraphicDevice::lineType_
private

Definition at line 28 of file AbstractGraphicDevice.h.

Referenced by getCurrentLineType().

◆ pointSize_

unsigned int bpp::AbstractGraphicDevice::pointSize_
private

Definition at line 27 of file AbstractGraphicDevice.h.

Referenced by getCurrentPointSize().

◆ TEXT_HORIZONTAL_CENTER

short GraphicDevice::TEXT_HORIZONTAL_CENTER = 0
staticinherited

Definition at line 143 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ TEXT_HORIZONTAL_LEFT

◆ TEXT_HORIZONTAL_RIGHT

short GraphicDevice::TEXT_HORIZONTAL_RIGHT = 2
staticinherited

Definition at line 145 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ TEXT_VERTICAL_BOTTOM

◆ TEXT_VERTICAL_CENTER

short GraphicDevice::TEXT_VERTICAL_CENTER = 3
staticinherited

Definition at line 146 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ TEXT_VERTICAL_TOP

short GraphicDevice::TEXT_VERTICAL_TOP = 5
staticinherited

Definition at line 148 of file GraphicDevice.h.

Referenced by bpp::PgfGraphicDevice::drawText().

◆ xUnit_

double bpp::AbstractGraphicDevice::xUnit_
private

Definition at line 22 of file AbstractGraphicDevice.h.

Referenced by getXUnit(), revx_(), and x_().

◆ yUnit_

double bpp::AbstractGraphicDevice::yUnit_
private

Definition at line 23 of file AbstractGraphicDevice.h.

Referenced by getYUnit(), revy_(), and y_().


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