Board 0.9.6
Public Member Functions | List of all members
LibBoard::Image Struct Reference

Structure for a bitmap image shape. More...

#include <Image.h>

Inheritance diagram for LibBoard::Image:
LibBoard::Shape

Public Member Functions

 Image (const char *filename, double left, double top, double width, double height=0.0)
 
 Image (const char *filename, const Rect &rect)
 
const std::string & name () const override
 
Image * clone () const override
 
Shape & rotate (double angle, const Point &center) override
 
Shape & rotate (double angle) override
 
Image rotated (double angle) const
 
Image rotated (double angle, const Point &) const
 
Shape & translate (double dx, double dy) override
 
Image translated (double dx, double dy) const
 
Shape & scale (double sx, double sy) override
 
Shape & scale (double s) override
 
Image scaled (double sx, double sy)
 
Rect boundingBox (LineWidthFlag lineWidthFlag) const override
 
void scaleAll (double s) override
 
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const override
 
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override
 
void flushSVG (std::ostream &stream, const TransformSVG &transform) const override
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const override
 
virtual void accept (ShapeVisitor &visitor) override
 Accepts a visitor object.
 
virtual void accept (const ShapeVisitor &visitor) override
 Accepts a visitor object.
 
virtual void accept (ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object.
 
virtual void accept (const ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object.
 
virtual Shape * accept (CompositeShapeTransform &transform) const override
 Accept a composite shape transform.
 
virtual Shape * accept (const CompositeShapeTransform &transform) const override
 Accept a constant composite shape transform.
 
 Image (const Image &)=default
 
 Image (Image &&)=default
 
Image & operator= (Image &&)=default
 
 ~Image () override=default
 
- Public Member Functions inherited from LibBoard::Shape
 Shape ()
 
virtual ~Shape ()
 
virtual const std::string & name () const
 
virtual Shape * clone () const =0
 
virtual Point center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const
 
virtual Shape & rotate (double angle, const Point &center)=0
 
virtual Shape & rotate (double angle)=0
 
Shape & rotateDeg (double angle, const Point &center)
 
Shape & rotateDeg (double angle)
 
virtual Shape & translate (double dx, double dy)=0
 
Shape & moveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
 
Shape & moveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
 
virtual Shape & scale (double sx, double sy)=0
 
virtual Shape & scale (double s)=0
 
Shape & resize (double width, double height, LineWidthFlag lineWidthFlag)
 
Shape & scaleToWidth (double w, LineWidthFlag lineWidthFlag)
 
Shape & scaleToHeight (double h, LineWidthFlag lineWidthFlag)
 
virtual Rect boundingBox (LineWidthFlag) const =0
 
Rect bbox (LineWidthFlag) const
 
virtual void scaleAll (double s)=0
 
virtual void flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0
 
virtual void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const =0
 
virtual void flushSVG (std::ostream &stream, const TransformSVG &transform) const =0
 
virtual void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0
 
virtual void accept (ShapeVisitor &visitor)
 Accepts a visitor object.
 
virtual void accept (const ShapeVisitor &visitor)
 Accepts a visitor object.
 
virtual void accept (ConstShapeVisitor &visitor) const
 Accepts a const-shape visitor object.
 
virtual void accept (const ConstShapeVisitor &visitor) const
 Accepts a const-shape visitor object.
 
virtual Shape * accept (CompositeShapeTransform &transform) const
 Accept a composite shape transform.
 
virtual Shape * accept (const CompositeShapeTransform &transform) const
 Accept a constant composite shape transform.
 
 Shape (const Shape &other)
 

Detailed Description

Structure for a bitmap image shape.

Image structure.

Examples
examples/images.cpp.

Constructor & Destructor Documentation

◆ Image() [1/4]

LibBoard::Image::Image ( const char *  filename,
double  left,
double  top,
double  width,
double  height = 0.0 
)

Construct an Image given a filename, a size and (possibly) a depth. If the height parameter is 0.0, then the correct height is computed according to the actual aspect ratio of the bitmap image, obtained from the file.

Parameters
filename
left
top
width
height

References LibBoard::Color::Black, LibBoard::ButtCap, LibBoard::Tools::error, LibBoard::MiterJoin, LibBoard::Color::Null, LibBoard::rectangle(), and LibBoard::SolidStyle.

◆ Image() [2/4]

LibBoard::Image::Image ( const char *  filename,
const Rect &  rect 
)

Construct an Image given a filename, a size and (possibly) a depth.

Parameters
filenameThe image filename
rectThe position and size of the image

◆ Image() [3/4]

LibBoard::Image::Image ( const Image &  )
default

◆ Image() [4/4]

LibBoard::Image::Image ( Image &&  )
default

◆ ~Image()

LibBoard::Image::~Image ( )
overridedefault

Member Function Documentation

◆ accept() [1/6]

Shape * LibBoard::Image::accept ( CompositeShapeTransform &  transform) const
overridevirtual

Accept a composite shape transform.

Parameters
transformA composite shape transform object.

Reimplemented from LibBoard::Shape.

References LibBoard::CompositeShapeTransform::map().

◆ accept() [2/6]

Shape * LibBoard::Image::accept ( const CompositeShapeTransform &  transform) const
overridevirtual

Accept a constant composite shape transform.

Parameters
transformA constant composite shape transform object..

Reimplemented from LibBoard::Shape.

References LibBoard::CompositeShapeTransform::map().

◆ accept() [3/6]

void LibBoard::Image::accept ( const ConstShapeVisitor &  visitor) const
overridevirtual

Accepts a const-shape visitor object.

Parameters
visitorA const-shape visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ConstShapeVisitor::visit().

◆ accept() [4/6]

void LibBoard::Image::accept ( const ShapeVisitor &  visitor)
overridevirtual

Accepts a visitor object.

Parameters
visitorA visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ShapeVisitor::visit().

◆ accept() [5/6]

void LibBoard::Image::accept ( ConstShapeVisitor &  visitor) const
overridevirtual

Accepts a const-shape visitor object.

Parameters
visitorA const-shape visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ConstShapeVisitor::visit().

◆ accept() [6/6]

void LibBoard::Image::accept ( ShapeVisitor &  visitor)
overridevirtual

Accepts a visitor object.

Parameters
visitorA visitor object.

Reimplemented from LibBoard::Shape.

References LibBoard::ShapeVisitor::visit().

◆ boundingBox()

Rect LibBoard::Image::boundingBox ( LineWidthFlag  lineWidthFlag) const
overridevirtual

Returns the bounding box of the figure.

Parameters
lineWidthFlagShould the line width be considered when computing bounding boxes.
Returns
The rectangle of the bounding box.

Implements LibBoard::Shape.

Examples
examples/images.cpp.

References LibBoard::Polyline::boundingBox(), and LibBoard::IgnoreLineWidth.

Referenced by main().

◆ clone()

Image * LibBoard::Image::clone ( ) const
overridevirtual

Return a copy of the shape.

Returns

Implements LibBoard::Shape.

◆ flushFIG()

void LibBoard::Image::flushFIG ( std::ostream &  stream,
const TransformFIG &  transform,
std::map< Color, int > &  colormap 
) const
overridevirtual

Writes the FIG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.
colormap

Implements LibBoard::Shape.

References LibBoard::Shape::bbox(), LibBoard::Polyline::boundingBox(), LibBoard::Polyline::flushFIG(), LibBoard::Transform::mapX(), LibBoard::TransformFIG::mapY(), LibBoard::Color::Null, LibBoard::rectangle(), LibBoard::TransformFIG::shapeDepth(), LibBoard::UseLineWidth, and LibBoard::Polyline::vertexCount().

◆ flushPostscript()

void LibBoard::Image::flushPostscript ( std::ostream &  stream,
const TransformEPS &  transform 
) const
overridevirtual

Writes the EPS code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Tools::error, LibBoard::Tools::flushFile(), LibBoard::Tools::getEPSBoundingBox(), LibBoard::Rect::height, LibBoard::Transform::map(), LibBoard::Transform::scale(), LibBoard::TransformMatrix::scaling(), LibBoard::Tools::temporaryFilename(), and LibBoard::Rect::width.

◆ flushSVG()

void LibBoard::Image::flushSVG ( std::ostream &  stream,
const TransformSVG &  transform 
) const
overridevirtual

Writes the SVG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Tools::base64encode(), LibBoard::Tools::CaseInsensitive, LibBoard::Tools::error, flushSVG(), LibBoard::Transform::map(), LibBoard::Transform::scale(), and LibBoard::Tools::stringEndsWith().

Referenced by flushSVG().

◆ flushTikZ()

void LibBoard::Image::flushTikZ ( std::ostream &  stream,
const TransformTikZ &  transform 
) const
overridevirtual

Writes the TikZ code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::Tools::error, and LibBoard::Polyline::flushTikZ().

◆ name()

const std::string & LibBoard::Image::name ( ) const
overridevirtual

Returns the generic name of the shape (Image)

Returns

Reimplemented from LibBoard::Shape.

◆ operator=()

Image & LibBoard::Image::operator= ( Image &&  )
default

◆ rotate() [1/2]

Shape & LibBoard::Image::rotate ( double  angle)
overridevirtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Shape::center(), LibBoard::TransformMatrix::Postscript, LibBoard::Polyline::rotate(), LibBoard::TransformMatrix::rotation(), and LibBoard::TransformMatrix::SVG.

◆ rotate() [2/2]

Shape & LibBoard::Image::rotate ( double  angle,
const Point &  center 
)
overridevirtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Shape::center(), LibBoard::TransformMatrix::Postscript, LibBoard::Polyline::rotate(), LibBoard::TransformMatrix::rotation(), and LibBoard::TransformMatrix::SVG.

Referenced by rotated(), and rotated().

◆ rotated() [1/2]

Image LibBoard::Image::rotated ( double  angle) const

Returns a rotated copy of the image.

Parameters
angleThe rotation angle in radian.
Returns
A rotated copy of the image.

References rotate().

◆ rotated() [2/2]

Image LibBoard::Image::rotated ( double  angle,
const Point &  center 
) const

Returns a rotated copy of the image.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A rotated copy of the image.

References LibBoard::Shape::center(), and rotate().

◆ scale() [1/2]

Shape & LibBoard::Image::scale ( double  s)
overridevirtual

Scale the shape along both axis.

Parameters
sThe scale factor along both axis.
Returns
The shape itself.

Implements LibBoard::Shape.

References scale().

◆ scale() [2/2]

Shape & LibBoard::Image::scale ( double  sx,
double  sy 
)
overridevirtual

Scale the shape along the x an y axis.

Parameters
sxThe scale factor along the x axis.
syThe scale factor along the y axis.
Returns
The shape itself.

Implements LibBoard::Shape.

References LibBoard::Shape::center(), LibBoard::Polyline::scale(), LibBoard::TransformMatrix::scaling(), and LibBoard::TransformMatrix::translation().

Referenced by scale(), and scaled().

◆ scaleAll()

void LibBoard::Image::scaleAll ( double  s)
overridevirtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters
sThe scaling factor.

Implements LibBoard::Shape.

References LibBoard::Polyline::scaleAll(), and LibBoard::TransformMatrix::scaling().

◆ scaled()

Image LibBoard::Image::scaled ( double  sx,
double  sy 
)

Returns a scaled copy of the image.

Parameters
sxScale factor along the x axis.
syScale factor along the y axis.
Returns
A scaled copy of the image.

References scale().

◆ translate()

Shape & LibBoard::Image::translate ( double  dx,
double  dy 
)
overridevirtual

Translate the shape by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Polyline::translate().

Referenced by translated().

◆ translated()

Image LibBoard::Image::translated ( double  dx,
double  dy 
) const

Returns a translated copy of the image.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A translated copy of the image.

References translate().


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