Board  0.9.2
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 "board/Shapes.h"
29 #include "board/TransformMatrix.h"
30 #include <string>
31 
32 namespace LibBoard {
33 
39 struct Image : public Shape {
40 
56  Image( const char * filename,
57  double left, double top, double width, double height = 0.0,
58  int depth = -1 );
59 
69  Image( const char * filename, const Rect & rect, int depth = -1 );
70 
74  inline ~Image();
75 
81  const std::string & name() const;
82 
88  Image * clone() const;
89 
95  Point center() const;
96 
105  Shape & rotate( double angle, const Point & center );
106 
114  Shape & rotate( double angle );
115 
123  Image rotated(double angle) const;
124 
133  Image rotated(double angle, const Point & ) const;
134 
143  inline Shape & rotateDeg( double angle, const Point & center );
144 
153  inline Shape & rotateDeg( double angle );
154 
163  Shape & translate( double dx, double dy );
164 
173  Image translated(double dx, double dy) const;
174 
183  Shape & scale( double sx, double sy );
184 
192  Shape & scale( double s );
193 
202  Image scaled(double sx, double sy);
203 
209  Rect boundingBox() const;
210 
217  void scaleAll( double s );
218 
226  void flushPostscript( std::ostream & stream,
227  const TransformEPS & transform ) const;
228 
236  void flushFIG( std::ostream & stream,
237  const TransformFIG & transform,
238  std::map<Color,int> & colormap ) const;
239 
247  void flushSVG( std::ostream & stream,
248  const TransformSVG & transform ) const;
249 
257  void flushTikZ( std::ostream & stream,
258  const TransformTikZ & transform ) const;
259 
260 private:
261  static const std::string _name;
262  Rectangle _rectangle;
263  Rectangle _originalRectangle;
264  TransformMatrix _transformMatrixSVG;
265  TransformMatrix _transformMatrixEPS;
266  std::string _filename;
267 };
268 
270 {}
271 
272 
273 } // namespace LibBoard
274 
275 #endif /* _SHAPE_H_ */
276 
Abstract structure for a 2D shape.
Definition: Shapes.h:56
Point center() const
Definition: Image.cpp:89
Rect boundingBox() const
Definition: Image.cpp:168
Definition: TransformMatrix.h:35
Structure representing a scaling and translation suitable for an TikZ output.
Definition: Transforms.h:130
Definition: Board.h:40
void flushFIG(std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const
Definition: Image.cpp:216
Shape & scale(double sx, double sy)
Definition: Image.cpp:140
Image translated(double dx, double dy) const
Definition: Image.cpp:134
Shape & rotateDeg(double angle, const Point &center)
Struct representing a 2D point.
Definition: Point.h:38
Structure representing a scaling and translation suitable for an XFig output.
Definition: Transforms.h:87
void flushSVG(std::ostream &stream, const TransformSVG &transform) const
Definition: Image.cpp:234
Structure representing a scaling and translation suitable for an SVG output.
Definition: Transforms.h:109
Shape & rotate(double angle, const Point &center)
Definition: Image.cpp:95
Structure for a bitmap image shape.
Definition: Image.h:39
void scaleAll(double s)
Definition: Image.cpp:174
void flushTikZ(std::ostream &stream, const TransformTikZ &transform) const
Definition: Image.cpp:259
Image * clone() const
Definition: Image.cpp:83
Image scaled(double sx, double sy)
Definition: Image.cpp:162
A rectangle.
Definition: Shapes.h:924
Image(const char *filename, double left, double top, double width, double height=0.0, int depth=-1)
Definition: Image.cpp:43
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
~Image()
Definition: Image.h:269
Shape & translate(double dx, double dy)
Definition: Image.cpp:125
const std::string & name() const
Definition: Image.cpp:77
Structure representing a scaling and translation suitable for an EPS output.
Definition: Transforms.h:73
Image rotated(double angle) const
Definition: Image.cpp:114
@copyright This source code is part of the Board project, a C++ library whose purpose is to allow sim...
Struct representing a rectangle on the plane.
Definition: Rect.h:38
void flushPostscript(std::ostream &stream, const TransformEPS &transform) const
Definition: Image.cpp:182