#include <mrpt/utils/CMRPTCanvas.h>
Public Types | |
enum | TPenStyle { psSolid = 0, psDash, psDot, psDashDot, psDashDotDot } |
Definition of pen styles. More... | |
Public Member Functions | |
CMRPTCanvas () | |
virtual | ~CMRPTCanvas () |
Dummy virtual destructor:. | |
virtual void | setPixel (int x, int y, size_t color)=0 |
Changes the value of the pixel (x,y). | |
virtual size_t | getWidth () const =0 |
Returns the width of the image in pixels. | |
virtual size_t | getHeight () const =0 |
Returns the height of the image in pixels. | |
virtual void | line (int x0, int y0, int x1, int y1, unsigned int color, unsigned int width=1, TPenStyle penStyle=psSolid) |
Draws a line. | |
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). | |
void | triangle (int x0, int y0, int size, unsigned int color, bool inferior=true, unsigned int width=1) |
Draws a triangle. | |
virtual void | filledRectangle (int x0, int y0, int x1, int y1, unsigned int color) |
Draws a filled rectangle. | |
virtual void | textOut (int x0, int y0, const std::string &str, unsigned int color) |
Renders 2D text using bitmap fonts. | |
virtual void | selectTextFont (const std::string &fontName) |
Select the current font used when drawing text. | |
virtual void | drawImage (int x, int y, const utils::CMRPTImage &img) |
Draws an image as a bitmap at a given position. | |
void | cross (int x0, int y0, unsigned int color, char type, unsigned int size=5, unsigned int width=1) |
Draw a cross. | |
virtual 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 | 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::CMRPTImageFloat &img, float rotation, float scale) |
Draws an image as a bitmap at a given position, with some custom scale and rotation changes. | |
void | drawCircle (int x, int y, int radius, unsigned int color=0xFFFFFF, unsigned int width=1) |
Draws a circle of a given radius. | |
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. | |
Protected Attributes | |
std::string | m_selectedFont |
The selected font name. | |
const uint32_t * | m_selectedFontBitmaps |
Direct access to character bitmaps. |
A number of text fonts can be selected with CMRPTCanvas::selectTextFont(). These are the implemented font names:
For an example of each font check the corresponding wiki page.
Definition at line 63 of file CMRPTCanvas.h.
mrpt::utils::CMRPTCanvas::CMRPTCanvas | ( | ) |
virtual mrpt::utils::CMRPTCanvas::~CMRPTCanvas | ( | ) | [inline, virtual] |
void mrpt::utils::CMRPTCanvas::cross | ( | int | x0, | |
int | y0, | |||
unsigned int | color, | |||
char | type, | |||
unsigned int | size = 5 , |
|||
unsigned int | width = 1 | |||
) |
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 "+" | |
width | The desired width of the cross (this is IGNORED yet) |
void mrpt::utils::CMRPTCanvas::drawCircle | ( | int | x, | |
int | y, | |||
int | radius, | |||
unsigned int | color = 0xFFFFFF , |
|||
unsigned int | width = 1 | |||
) |
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::CMRPTCanvas::drawImage | ( | int | x, | |
int | y, | |||
const utils::CMRPTImageFloat & | img, | |||
float | rotation, | |||
float | scale | |||
) |
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 actually calls internally to "drawImage" with a "CMRPTImage" parameter. |
void mrpt::utils::CMRPTCanvas::drawImage | ( | int | x, | |
int | y, | |||
const utils::CMRPTImageFloat & | img | |||
) |
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 actually calls internally to "drawImage" with a "CMRPTImage" parameter. |
Reimplemented in mrpt::utils::CEnhancedMetaFile.
virtual void mrpt::utils::CMRPTCanvas::drawImage | ( | int | x, | |
int | y, | |||
const utils::CMRPTImage & | img, | |||
float | rotation, | |||
float | scale | |||
) | [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 in mrpt::utils::CEnhancedMetaFile.
virtual void mrpt::utils::CMRPTCanvas::drawImage | ( | int | x, | |
int | y, | |||
const utils::CMRPTImage & | 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 in mrpt::utils::CEnhancedMetaFile.
Referenced by mrpt::utils::CEnhancedMetaFile::drawImage().
void mrpt::utils::CMRPTCanvas::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 | |||
) | [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. |
Reimplemented in mrpt::utils::CEnhancedMetaFile.
Definition at line 288 of file CMRPTCanvas.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().
virtual void mrpt::utils::CMRPTCanvas::filledRectangle | ( | int | x0, | |
int | y0, | |||
int | x1, | |||
int | y1, | |||
unsigned int | color | |||
) | [virtual] |
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::CMRPTCanvas::getHeight | ( | ) | const [pure virtual] |
Returns the height of the image in pixels.
Implemented in mrpt::utils::CEnhancedMetaFile, mrpt::utils::CMRPTImage, and mrpt::utils::CMRPTImageFloat.
virtual size_t mrpt::utils::CMRPTCanvas::getWidth | ( | ) | const [pure virtual] |
Returns the width of the image in pixels.
Implemented in mrpt::utils::CEnhancedMetaFile, mrpt::utils::CMRPTImage, and mrpt::utils::CMRPTImageFloat.
virtual void mrpt::utils::CMRPTCanvas::line | ( | int | x0, | |
int | y0, | |||
int | x1, | |||
int | y1, | |||
unsigned int | 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 in mrpt::utils::CEnhancedMetaFile.
void mrpt::utils::CMRPTCanvas::rectangle | ( | int | x0, | |
int | y0, | |||
int | x1, | |||
int | y1, | |||
unsigned int | color, | |||
unsigned int | width = 1 | |||
) |
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 in mrpt::utils::CEnhancedMetaFile.
virtual void mrpt::utils::CMRPTCanvas::selectTextFont | ( | const std::string & | fontName | ) | [virtual] |
virtual void mrpt::utils::CMRPTCanvas::setPixel | ( | int | x, | |
int | y, | |||
size_t | color | |||
) | [pure 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.
Implemented in mrpt::utils::CEnhancedMetaFile, mrpt::utils::CMRPTImage, and mrpt::utils::CMRPTImageFloat.
virtual void mrpt::utils::CMRPTCanvas::textOut | ( | int | x0, | |
int | y0, | |||
const std::string & | str, | |||
unsigned int | color | |||
) | [virtual] |
Renders 2D text using bitmap fonts.
x0 | The x coordinates | |
y0 | The y coordinates | |
str | The string to put. If using UNICODE characters, use UTF-8 encoding. | |
color | The text color |
Reimplemented in mrpt::utils::CEnhancedMetaFile.
void mrpt::utils::CMRPTCanvas::triangle | ( | int | x0, | |
int | y0, | |||
int | size, | |||
unsigned int | color, | |||
bool | inferior = true , |
|||
unsigned int | width = 1 | |||
) |
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. |
std::string mrpt::utils::CMRPTCanvas::m_selectedFont [protected] |
const uint32_t* mrpt::utils::CMRPTCanvas::m_selectedFontBitmaps [protected] |
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN: at Thu Feb 26 02:14:51 EST 2009 |