Board 0.9.6
Image.h
Go to the documentation of this file.
1/* -*- mode: c++ -*- */
25#ifndef BOARD_IMAGE_H
26#define BOARD_IMAGE_H
27
28#include <string>
29#include <board/Polyline.h>
30#include <board/Shape.h>
32
33namespace LibBoard
34{
35
41struct Image : public Shape {
42
57 Image(const char * filename, double left, double top, double width, double height = 0.0);
58
66 Image(const char * filename, const Rect & rect);
67
73 const std::string & name() const override;
74
80 Image * clone() const override;
81
90 Shape & rotate(double angle, const Point & center) override;
91
99 Shape & rotate(double angle) override;
100
108 Image rotated(double angle) const;
109
118 Image rotated(double angle, const Point &) const;
119
128 Shape & translate(double dx, double dy) override;
129
138 Image translated(double dx, double dy) const;
139
148 Shape & scale(double sx, double sy) override;
149
157 Shape & scale(double s) override;
158
167 Image scaled(double sx, double sy);
168
175 Rect boundingBox(LineWidthFlag lineWidthFlag) const override;
176
183 void scaleAll(double s) override;
184
192 void flushPostscript(std::ostream & stream, const TransformEPS & transform) const override;
193
202 void flushFIG(std::ostream & stream, const TransformFIG & transform, std::map<Color, int> & colormap) const override;
203
211 void flushSVG(std::ostream & stream, const TransformSVG & transform) const override;
212
220 void flushTikZ(std::ostream & stream, const TransformTikZ & transform) const override;
221
227 virtual void accept(ShapeVisitor & visitor) override;
228
234 virtual void accept(const ShapeVisitor & visitor) override;
235
241 virtual void accept(ConstShapeVisitor & visitor) const override;
242
248 virtual void accept(const ConstShapeVisitor & visitor) const override;
249
255 virtual Shape * accept(CompositeShapeTransform & transform) const override;
256
262 virtual Shape * accept(const CompositeShapeTransform & transform) const override;
263
264 Image(const Image &) = default;
265 Image(Image &&) = default;
266 Image & operator=(Image &&) = default;
267 ~Image() override = default;
268
269private:
270 static const std::string _name;
271 Polyline _rectangle;
272 Polyline _originalRectangle;
273 TransformMatrix _transformMatrixSVG;
274 TransformMatrix _transformMatrixEPS;
275 std::string _filename;
276};
277
278} // namespace LibBoard
279
280#endif /* SHAPE_H */
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Definition TransformMatrix.h:36
Definition Board.h:55
LineWidthFlag
Definition Style.h:57
A CompositeShapeTransform may be used to duplicate/transform a composite shape tree.
Definition ShapeVisitor.h:104
A ConstShapeVisitor may visit const shapes of a composite shape tree in back-to-front order.
Definition ShapeVisitor.h:79
Structure for a bitmap image shape.
Definition Image.h:41
Image * clone() const override
Definition Image.cpp:76
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const override
Definition Image.cpp:238
Shape & rotate(double angle, const Point &center) override
Definition Image.cpp:81
void scaleAll(double s) override
Definition Image.cpp:154
Image & operator=(Image &&)=default
Image(const Image &)=default
Image rotated(double angle) const
Definition Image.cpp:99
const std::string & name() const override
Definition Image.cpp:71
Rect boundingBox(LineWidthFlag lineWidthFlag) const override
Definition Image.cpp:149
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override
Definition Image.cpp:199
Shape & scale(double sx, double sy) override
Definition Image.cpp:122
virtual void accept(ShapeVisitor &visitor) override
Accepts a visitor object.
Definition Image.cpp:244
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const override
Definition Image.cpp:161
Image(Image &&)=default
~Image() override=default
Image translated(double dx, double dy) const
Definition Image.cpp:117
void flushSVG(std::ostream &stream, const TransformSVG &transform) const override
Definition Image.cpp:213
Shape & translate(double dx, double dy) override
Definition Image.cpp:109
Image scaled(double sx, double sy)
Definition Image.cpp:144
Struct representing a 2D point.
Definition Point.h:42
A polygonal line described by a series of 2D points.
Definition Polyline.h:38
Struct representing a rectangle on the plane.
Definition Rect.h:40
A ShapeVisitor visits all shapes in a composite shape tree in back-to-front order.
Definition ShapeVisitor.h:54
Abstract structure for a 2D shape.
Definition Shape.h:64
virtual Point center(LineWidthFlag lineWidthFlag=IgnoreLineWidth) const
Definition Shape.cpp:59
Structure representing a scaling and translation suitable for an EPS output.
Definition Transforms.h:71
Structure representing a scaling and translation suitable for an XFig output.
Definition Transforms.h:87
Structure representing a scaling and translation suitable for an SVG output.
Definition Transforms.h:109
Structure representing a scaling and translation suitable for an TikZ output.
Definition Transforms.h:126