MRPT logo

mrpt::utils::CEnhancedMetaFile Class Reference

This class represents a Windows Enhanced Meta File (EMF) for generating and saving graphics. More...

#include <mrpt/utils/CEnhancedMetaFile.h>

Inheritance diagram for mrpt::utils::CEnhancedMetaFile:

mrpt::utils::CMRPTCanvas

List of all members.

Public Member Functions

 CEnhancedMetaFile (const std::string &targetFileName, int scaleFactor=1)
 Constructor.
virtual ~CEnhancedMetaFile ()
 Destructor.
void setPixel (int x, int y, size_t color)
 Changes the value of the pixel (x,y).
size_t getWidth () const
 Returns the width of the image in pixels (this currently has no applicability for a EMF file.
size_t getHeight () const
 Returns the height of the image in pixels (this currently has no applicability for a EMF file.
void drawImage (int x, int y, const utils::CMRPTImage &img)
 Draws an image as a bitmap at a given position.
void line (int x0, int y0, int x1, int y1, unsigned int color, unsigned int width=1, TPenStyle penStyle=psSolid)
 Draws a line.
void textOut (int x0, int y0, const std::string &str, unsigned int color)
 Places a text label.
void selectTextFont (const std::string &fontName, int fontSize, bool bold=false, bool italic=false)
 Select the current font used when drawing text.
void drawImage (int x, int y, const utils::CMRPTImageFloat &img)
 Draws an image as a bitmap at a given position.
void drawImage (int x, int y, const utils::CMRPTImage &img, float rotation, float scale)
 Draws an image as a bitmap at a given position, with some custom scale and rotation changes.
void rectangle (int x0, int y0, int x1, int y1, unsigned int 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, unsigned int color=0xFFFFFF, unsigned int width=1, int nEllipsePoints=20)
 Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution.

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).

Private Attributes

void_ptr_noncopy m_hdc
int m_scale
void_ptr_noncopy m_hFont
std::string m_targetFile


Detailed Description

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.

Definition at line 45 of file CEnhancedMetaFile.h.


Constructor & Destructor Documentation

mrpt::utils::CEnhancedMetaFile::CEnhancedMetaFile ( const std::string &  targetFileName,
int  scaleFactor = 1 
)

Constructor.

Parameters:
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.


Member Function Documentation

void mrpt::utils::CEnhancedMetaFile::drawImage ( int  x,
int  y,
const utils::CMRPTImage img,
float  rotation,
float  scale 
) [inline, virtual]

Draws an image as a bitmap at a given position, with some custom scale and rotation changes.

Parameters:
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::CMRPTCanvas.

Definition at line 164 of file CEnhancedMetaFile.h.

References mrpt::utils::CMRPTCanvas::drawImage().

void mrpt::utils::CEnhancedMetaFile::drawImage ( int  x,
int  y,
const utils::CMRPTImageFloat img 
)

Draws an image as a bitmap at a given position.

Parameters:
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 actually calls internally to "drawImage" with a "CMRPTImage" parameter.

Reimplemented from mrpt::utils::CMRPTCanvas.

void mrpt::utils::CEnhancedMetaFile::drawImage ( int  x,
int  y,
const utils::CMRPTImage img 
) [virtual]

Draws an image as a bitmap at a given position.

Parameters:
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::CMRPTCanvas.

template<class T >
void mrpt::utils::CEnhancedMetaFile::ellipseGaussian ( math::CMatrixTemplateNumeric< T > *  cov2D,
mean_x,
mean_y,
float  confIntervalStds = 2,
unsigned int  color = 0xFFFFFF,
unsigned int  width = 1,
int  nEllipsePoints = 20 
) [inline]

Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution.

Parameters:
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.
Exceptions:
std::exception On an invalid matrix.

Reimplemented from mrpt::utils::CMRPTCanvas.

Definition at line 203 of file CEnhancedMetaFile.h.

References mrpt::math::CMatrixTemplateNumeric< T >::eigenVectors(), M_2PI, MRPT_TRY_END_WITH_CLEAN_UP, MRPT_TRY_START, mrpt::utils::round(), and mrpt::math::CMatrixTemplateNumeric< T >::Sqrt().

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::CMRPTCanvas.

Definition at line 85 of file CEnhancedMetaFile.h.

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::CMRPTCanvas.

Definition at line 81 of file CEnhancedMetaFile.h.

void mrpt::utils::CEnhancedMetaFile::line ( int  x0,
int  y0,
int  x1,
int  y1,
unsigned int  color,
unsigned int  width = 1,
TPenStyle  penStyle = psSolid 
) [virtual]

Draws a line.

Parameters:
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::CMRPTCanvas.

void mrpt::utils::CEnhancedMetaFile::rectangle ( int  x0,
int  y0,
int  x1,
int  y1,
unsigned int  color,
unsigned int  width = 1 
)

Draws a rectangle (an empty rectangle, without filling).

Parameters:
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.
See also:
filledRectangle

Reimplemented from mrpt::utils::CMRPTCanvas.

void mrpt::utils::CEnhancedMetaFile::selectTextFont ( const std::string &  fontName,
int  fontSize,
bool  bold = false,
bool  italic = false 
)

Select the current font used when drawing text.

Parameters:
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
See also:
textOut

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::CMRPTCanvas.

void mrpt::utils::CEnhancedMetaFile::textOut ( int  x0,
int  y0,
const std::string &  str,
unsigned int  color 
) [virtual]

Places a text label.

Parameters:
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.
See also:
rectangle

Reimplemented from mrpt::utils::CMRPTCanvas.


Member Data Documentation

In Linux, the size of the bitmap image that emulates the EMF (Default:600).

Definition at line 55 of file CEnhancedMetaFile.h.

In Linux, the size of the bitmap image that emulates the EMF (Default:800).

Definition at line 54 of file CEnhancedMetaFile.h.

Definition at line 48 of file CEnhancedMetaFile.h.

Definition at line 50 of file CEnhancedMetaFile.h.

Definition at line 49 of file CEnhancedMetaFile.h.

Definition at line 51 of file CEnhancedMetaFile.h.




Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Sun Aug 9 21:47:23 CEST 2009