This class represents a Windows Enhanced Meta File (EMF) for generating and saving graphics.
If used under Linux, a ".png", non-vectorial, file will be generated instead.
#include <mrpt/utils/CEnhancedMetaFile.h>

Public Types | |
| enum | TPenStyle { psSolid = 0, psDash, psDot, psDashDot, psDashDotDot } |
| Definition of pen styles. More... | |
Public Member Functions | |
| CEnhancedMetaFile (const std::string &targetFileName, int scaleFactor=1) | |
| Constructor. | |
| virtual | ~CEnhancedMetaFile () |
| Destructor. | |
| virtual void | setPixel (int x, int y, size_t color) |
| Changes the value of the pixel (x,y). | |
| virtual size_t | getWidth () const |
| Returns the width of the image in pixels (this currently has no applicability for a EMF file...) | |
| virtual size_t | getHeight () const |
| Returns the height of the image in pixels (this currently has no applicability for a EMF file...) | |
| virtual void | drawImage (int x, int y, const utils::CImage &img) |
| Draws an image as a bitmap at a given position. | |
| virtual void | line (int x0, int y0, int x1, int y1, const mrpt::utils::TColor color, unsigned int width=1, TPenStyle penStyle=psSolid) |
| Draws a line. | |
| virtual void | textOut (int x0, int y0, const std::string &str, const mrpt::utils::TColor color) |
| Places a text label. | |
| virtual void | selectTextFont (const std::string &fontName, int fontSize, bool bold=false, bool italic=false) |
| Select the current font used when drawing text. | |
| virtual void | drawImage (int x, int y, const utils::CImage &img, float rotation, float scale) |
| Draws an image as a bitmap at a given position, with some custom scale and rotation changes. | |
| virtual void | rectangle (int x0, int y0, int x1, int y1, const mrpt::utils::TColor color, unsigned int width=1) |
| Draws a rectangle (an empty rectangle, without filling) | |
| template<class T > | |
| void | ellipseGaussian (math::CMatrixTemplateNumeric< T > *cov2D, T mean_x, T mean_y, float confIntervalStds=2, const mrpt::utils::TColor color=mrpt::utils::TColor(255, 255, 255), unsigned int width=1, int nEllipsePoints=20) |
| Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution. | |
| void | triangle (int x0, int y0, int size, const mrpt::utils::TColor color, bool inferior=true, unsigned int width=1) |
| Draws a triangle. | |
| virtual void | filledRectangle (int x0, int y0, int x1, int y1, const mrpt::utils::TColor color) |
| Draws a filled rectangle. | |
| virtual void | selectTextFont (const std::string &fontName) |
| Select the current font used when drawing text. | |
| void | cross (int x0, int y0, const mrpt::utils::TColor color, char type, unsigned int size=5, unsigned int width=1) |
| Draw a cross. | |
| virtual void | drawCircle (int x, int y, int radius, const mrpt::utils::TColor color=mrpt::utils::TColor(255, 255, 255), unsigned int width=1) |
| Draws a circle of a given radius. | |
| template<class MATRIX2X2 > | |
| void | ellipseGaussian (const MATRIX2X2 *cov2D, const double mean_x, const double mean_y, double confIntervalStds=2, const mrpt::utils::TColor color=mrpt::utils::TColor(255, 255, 255), unsigned int width=1, int nEllipsePoints=20) |
| Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution. | |
| template<class FEATURELIST > | |
| void | drawFeaturesSimple (const FEATURELIST &list, const TColor &color=TColor::red) |
| Draws a set of marks onto the image, given a generic container of entities having just "x" and "y" fields. | |
| template<class FEATURELIST > | |
| void | drawFeatures (const FEATURELIST &list, const TColor &color=TColor::red, const bool showIDs=false, const bool showResponse=false) |
| Draws a set of marks (or scaled circles for features with scale) onto the image, given a generic container of features. | |
Static Public Attributes | |
| static int | LINUX_IMG_WIDTH |
| In Linux, the size of the bitmap image that emulates the EMF (Default:800) | |
| static int | LINUX_IMG_HEIGHT |
| In Linux, the size of the bitmap image that emulates the EMF (Default:600) | |
Protected Attributes | |
| std::string | m_selectedFont |
| The selected font name. | |
| const uint32_t * | m_selectedFontBitmaps |
| Direct access to character bitmaps. | |
Private Attributes | |
| void_ptr_noncopy | m_hdc |
| int | m_scale |
| void_ptr_noncopy | m_hFont |
| std::string | m_targetFile |
enum mrpt::utils::CCanvas::TPenStyle [inherited] |
| mrpt::utils::CEnhancedMetaFile::CEnhancedMetaFile | ( | const std::string & | targetFileName, |
| int | scaleFactor = 1 |
||
| ) |
Constructor.
| targetFileName | This file will be created and the EMF saved there. |
| scaleFactor | All coordinates in draw commands will be internally multiplied by this scale, to provide a way of obtaining "subpixel" drawing. |
| virtual mrpt::utils::CEnhancedMetaFile::~CEnhancedMetaFile | ( | ) | [virtual] |
Destructor.
| void mrpt::utils::CCanvas::cross | ( | int | x0, |
| int | y0, | ||
| const mrpt::utils::TColor | color, | ||
| char | type, | ||
| unsigned int | size = 5, |
||
| unsigned int | width = 1 |
||
| ) | [inherited] |
Draw a cross.
| x0 | The point x coordinate |
| y0 | The point y coordinate |
| color | The color of the cross |
| size | The size of the cross |
| type | The cross type. It could be: 'x', '+' or ':'(like '+' but clear at the center dot) |
| width | The desired width of the cross (this is IGNORED yet) |
| virtual void mrpt::utils::CCanvas::drawCircle | ( | int | x, |
| int | y, | ||
| int | radius, | ||
| const mrpt::utils::TColor | color = mrpt::utils::TColor(255, 255, 255), |
||
| unsigned int | width = 1 |
||
| ) | [virtual, inherited] |
Draws a circle of a given radius.
| x | The center - x coordinate in pixels. |
| y | The center - y coordinate in pixels. |
| radius | The radius - in pixels. |
| color | The color of the circle. |
| width | The desired width of the line (this is IGNORED in this virtual class) |
| void mrpt::utils::CCanvas::drawFeatures | ( | const FEATURELIST & | list, |
| const TColor & | color = TColor::red, |
||
| const bool | showIDs = false, |
||
| const bool | showResponse = false |
||
| ) | [inline, inherited] |
Draws a set of marks (or scaled circles for features with scale) onto the image, given a generic container of features.
The class of FEATURELIST can be:
Definition at line 347 of file CCanvas.h.
References mrpt::utils::round(), and mrpt::format().
| void mrpt::utils::CCanvas::drawFeaturesSimple | ( | const FEATURELIST & | list, |
| const TColor & | color = TColor::red |
||
| ) | [inline, inherited] |
Draws a set of marks onto the image, given a generic container of entities having just "x" and "y" fields.
The class of FEATURELIST can be, for example, std::vector<TPoint2D>, std::vector<TPixelCoordsf> or mrpt::vision::CFeatureList
Definition at line 329 of file CCanvas.h.
References mrpt::utils::round().
| virtual void mrpt::utils::CEnhancedMetaFile::drawImage | ( | int | x, |
| int | y, | ||
| const utils::CImage & | img | ||
| ) | [virtual] |
Draws an image as a bitmap at a given position.
| x0 | The top-left corner x coordinates on this canvas where the image is to be drawn |
| y0 | The top-left corner y coordinates on this canvas where the image is to be drawn |
| img | The image to be drawn in this canvas This method may be redefined in some classes implementing this interface in a more appropiate manner. |
Reimplemented from mrpt::utils::CCanvas.
| virtual void mrpt::utils::CEnhancedMetaFile::drawImage | ( | int | x, |
| int | y, | ||
| const utils::CImage & | img, | ||
| float | rotation, | ||
| float | scale | ||
| ) | [inline, virtual] |
Draws an image as a bitmap at a given position, with some custom scale and rotation changes.
| x0 | The top-left corner x coordinates on this canvas where the image is to be drawn |
| y0 | The top-left corner y coordinates on this canvas where the image is to be drawn |
| rotation | The rotation in radians, positive values being anti-clockwise direction, 0 is the normal position. |
| scale | The scale factor, e.g. 2 means twice the original size. |
| img | The image to be drawn in this canvas This method may be redefined in some classes implementing this interface in a more appropiate manner. |
Reimplemented from mrpt::utils::CCanvas.
Definition at line 154 of file CEnhancedMetaFile.h.
References mrpt::utils::CCanvas::drawImage().
| void mrpt::utils::CEnhancedMetaFile::ellipseGaussian | ( | math::CMatrixTemplateNumeric< T > * | cov2D, |
| T | mean_x, | ||
| T | mean_y, | ||
| float | confIntervalStds = 2, |
||
| const mrpt::utils::TColor | color = mrpt::utils::TColor(255,255,255), |
||
| unsigned int | width = 1, |
||
| int | nEllipsePoints = 20 |
||
| ) | [inline] |
Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution.
| mean_x | The x coordinate of the center point of the ellipse. |
| mean_y | The y coordinate of the center point of the ellipse. |
| cov2D | A 2x2 covariance matrix. |
| confIntervalStds | How many "sigmas" for the confidence level (i.e. 2->95%, 3=99.97%,...) |
| color | The color of the ellipse |
| width | The desired width of the line (this is IGNORED in this virtual class) |
| nEllipsePoints | The number of points to generate to approximate the ellipse shape. |
| std::exception | On an invalid matrix. |
Definition at line 193 of file CEnhancedMetaFile.h.
References MRPT_START, M_2PI, mrpt::utils::round(), and MRPT_END_WITH_CLEAN_UP.
| void mrpt::utils::CCanvas::ellipseGaussian | ( | const MATRIX2X2 * | cov2D, |
| const double | mean_x, | ||
| const double | mean_y, | ||
| double | confIntervalStds = 2, |
||
| const mrpt::utils::TColor | color = mrpt::utils::TColor(255,255,255), |
||
| unsigned int | width = 1, |
||
| int | nEllipsePoints = 20 |
||
| ) | [inline, inherited] |
Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution.
| mean_x | The x coordinate of the center point of the ellipse. |
| mean_y | The y coordinate of the center point of the ellipse. |
| cov2D | A 2x2 covariance matrix. |
| confIntervalStds | How many "sigmas" for the confidence level (i.e. 2->95%, 3=99.97%,...) |
| color | The color of the ellipse |
| width | The desired width of the line (this is IGNORED in this virtual class) |
| nEllipsePoints | The number of points to generate to approximate the ellipse shape. |
| std::exception | On an invalid matrix. |
Definition at line 280 of file CCanvas.h.
References MRPT_START, M_2PI, mrpt::utils::round(), and MRPT_END_WITH_CLEAN_UP.
| virtual void mrpt::utils::CCanvas::filledRectangle | ( | int | x0, |
| int | y0, | ||
| int | x1, | ||
| int | y1, | ||
| const mrpt::utils::TColor | color | ||
| ) | [virtual, inherited] |
Draws a filled rectangle.
| x0 | The top-left x coordinate |
| y0 | The top-left y coordinate |
| x1 | The right-bottom x coordinate |
| y1 | The right-bottom y coordinate |
| color | The color of the rectangle fill This method may be redefined in some classes implementing this interface in a more appropiate manner. |
| virtual size_t mrpt::utils::CEnhancedMetaFile::getHeight | ( | ) | const [inline, virtual] |
Returns the height of the image in pixels (this currently has no applicability for a EMF file...)
Implements mrpt::utils::CCanvas.
Definition at line 86 of file CEnhancedMetaFile.h.
| virtual size_t mrpt::utils::CEnhancedMetaFile::getWidth | ( | ) | const [inline, virtual] |
Returns the width of the image in pixels (this currently has no applicability for a EMF file...)
Implements mrpt::utils::CCanvas.
Definition at line 82 of file CEnhancedMetaFile.h.
| virtual void mrpt::utils::CEnhancedMetaFile::line | ( | int | x0, |
| int | y0, | ||
| int | x1, | ||
| int | y1, | ||
| const mrpt::utils::TColor | color, | ||
| unsigned int | width = 1, |
||
| TPenStyle | penStyle = psSolid |
||
| ) | [virtual] |
Draws a line.
| x0 | The starting point x coordinate |
| y0 | The starting point y coordinate |
| x1 | The end point x coordinate |
| y1 | The end point y coordinate |
| color | The color of the line |
| width | The desired width of the line (this is IGNORED in this virtual class) This method may be redefined in some classes implementing this interface in a more appropiate manner. |
Reimplemented from mrpt::utils::CCanvas.
| virtual void mrpt::utils::CEnhancedMetaFile::rectangle | ( | int | x0, |
| int | y0, | ||
| int | x1, | ||
| int | y1, | ||
| const mrpt::utils::TColor | color, | ||
| unsigned int | width = 1 |
||
| ) | [virtual] |
Draws a rectangle (an empty rectangle, without filling)
| x0 | The top-left x coordinate |
| y0 | The top-left y coordinate |
| x1 | The right-bottom x coordinate |
| y1 | The right-bottom y coordinate |
| color | The color of the line |
| width | The desired width of the line. |
Reimplemented from mrpt::utils::CCanvas.
| virtual void mrpt::utils::CEnhancedMetaFile::selectTextFont | ( | const std::string & | fontName, |
| int | fontSize, | ||
| bool | bold = false, |
||
| bool | italic = false |
||
| ) | [virtual] |
Select the current font used when drawing text.
| fontName | The face name of a font (e.g. "Arial","System",...) |
| fontSize | The size of the font in pts. |
| bold | Whether the font is bold |
| italic | Whether the font is italic |
| virtual void mrpt::utils::CCanvas::selectTextFont | ( | const std::string & | fontName | ) | [virtual, inherited] |
Select the current font used when drawing text.
| fontName | The name of the font |
Valid font names:
| virtual void mrpt::utils::CEnhancedMetaFile::setPixel | ( | int | x, |
| int | y, | ||
| size_t | color | ||
| ) | [virtual] |
Changes the value of the pixel (x,y).
Pixel coordinates starts at the left-top corner of the image, and start in (0,0). The meaning of the parameter "color" depends on the implementation: it will usually be a 24bit RGB value (0x00RRGGBB), but it can also be just a 8bit gray level. This method must support (x,y) values OUT of the actual image size without neither raising exceptions, nor leading to memory access errors.
Implements mrpt::utils::CCanvas.
| virtual void mrpt::utils::CEnhancedMetaFile::textOut | ( | int | x0, |
| int | y0, | ||
| const std::string & | str, | ||
| const mrpt::utils::TColor | color | ||
| ) | [virtual] |
Places a text label.
| x0 | The x coordinates |
| y0 | The y coordinates |
| str | The string to put |
| color | The text color |
| fontSize | The font size, in "points" This method may be redefined in some classes implementing this interface in a more appropiate manner. |
Reimplemented from mrpt::utils::CCanvas.
| void mrpt::utils::CCanvas::triangle | ( | int | x0, |
| int | y0, | ||
| int | size, | ||
| const mrpt::utils::TColor | color, | ||
| bool | inferior = true, |
||
| unsigned int | width = 1 |
||
| ) | [inherited] |
Draws a triangle.
| x0 | The triangle center x coordinate |
| y0 | The triangle center y coordinate |
| size | The size of the triangle |
| color | The color of the line |
| inferior | The position of the triangle |
| width | The desired width of the line. |
int mrpt::utils::CEnhancedMetaFile::LINUX_IMG_HEIGHT [static] |
In Linux, the size of the bitmap image that emulates the EMF (Default:600)
Definition at line 56 of file CEnhancedMetaFile.h.
int mrpt::utils::CEnhancedMetaFile::LINUX_IMG_WIDTH [static] |
In Linux, the size of the bitmap image that emulates the EMF (Default:800)
Definition at line 55 of file CEnhancedMetaFile.h.
Definition at line 49 of file CEnhancedMetaFile.h.
Definition at line 51 of file CEnhancedMetaFile.h.
int mrpt::utils::CEnhancedMetaFile::m_scale [private] |
Definition at line 50 of file CEnhancedMetaFile.h.
std::string mrpt::utils::CCanvas::m_selectedFont [protected, inherited] |
const uint32_t* mrpt::utils::CCanvas::m_selectedFontBitmaps [protected, inherited] |
Definition at line 52 of file CEnhancedMetaFile.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |