Board 0.9.6
|
Structure for a bitmap image shape. More...
#include <Image.h>
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 ¢er) 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 ¢er)=0 |
virtual Shape & | rotate (double angle)=0 |
Shape & | rotateDeg (double angle, const Point ¢er) |
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) | |
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.
filename | |
left | |
top | |
width | |
height |
References LibBoard::Color::Black, LibBoard::ButtCap, LibBoard::Tools::error, LibBoard::MiterJoin, LibBoard::Color::Null, LibBoard::rectangle(), and LibBoard::SolidStyle.
LibBoard::Image::Image | ( | const char * | filename, |
const Rect & | rect | ||
) |
Construct an Image given a filename, a size and (possibly) a depth.
filename | The image filename |
rect | The position and size of the image |
|
default |
|
default |
|
overridedefault |
|
overridevirtual |
Accept a composite shape transform.
transform | A composite shape transform object. |
Reimplemented from LibBoard::Shape.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accept a constant composite shape transform.
transform | A constant composite shape transform object.. |
Reimplemented from LibBoard::Shape.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Returns the bounding box of the figure.
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
Implements LibBoard::Shape.
References LibBoard::Polyline::boundingBox(), and LibBoard::IgnoreLineWidth.
Referenced by main().
|
overridevirtual |
|
overridevirtual |
Writes the FIG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 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().
|
overridevirtual |
Writes the EPS code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 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.
|
overridevirtual |
Writes the SVG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 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().
|
overridevirtual |
Writes the TikZ code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
References LibBoard::Tools::error, and LibBoard::Polyline::flushTikZ().
|
overridevirtual |
|
overridevirtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
References LibBoard::Shape::center(), LibBoard::TransformMatrix::Postscript, LibBoard::Polyline::rotate(), LibBoard::TransformMatrix::rotation(), and LibBoard::TransformMatrix::SVG.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
References LibBoard::Shape::center(), LibBoard::TransformMatrix::Postscript, LibBoard::Polyline::rotate(), LibBoard::TransformMatrix::rotation(), and LibBoard::TransformMatrix::SVG.
Image LibBoard::Image::rotated | ( | double | angle | ) | const |
Returns a rotated copy of the image.
angle | The rotation angle in radian. |
References rotate().
Returns a rotated copy of the image.
angle | The rotation angle in radian. |
center | The center of rotation. |
References LibBoard::Shape::center(), and rotate().
|
overridevirtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
References scale().
|
overridevirtual |
Scale the shape along the x an y axis.
sx | The scale factor along the x axis. |
sy | The scale factor along the y axis. |
Implements LibBoard::Shape.
References LibBoard::Shape::center(), LibBoard::Polyline::scale(), LibBoard::TransformMatrix::scaling(), and LibBoard::TransformMatrix::translation().
|
overridevirtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
References LibBoard::Polyline::scaleAll(), and LibBoard::TransformMatrix::scaling().
Image LibBoard::Image::scaled | ( | double | sx, |
double | sy | ||
) |
Returns a scaled copy of the image.
sx | Scale factor along the x axis. |
sy | Scale factor along the y axis. |
References scale().
|
overridevirtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
References LibBoard::Polyline::translate().
Referenced by translated().
Image LibBoard::Image::translated | ( | double | dx, |
double | dy | ||
) | const |
Returns a translated copy of the image.
dx | The x offset. |
dy | The y offset. |
References translate().