MRPT
1.9.9
|
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 23 of file CEnhancedMetaFile.h.
#include <mrpt/img/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. More... | |
~CEnhancedMetaFile () override | |
Destructor. More... | |
void | setPixel (int x, int y, size_t color) override |
Changes the value of the pixel (x,y). More... | |
size_t | getWidth () const override |
Returns the width of the image in pixels (this currently has no applicability for a EMF file...) More... | |
size_t | getHeight () const override |
Returns the height of the image in pixels (this currently has no applicability for a EMF file...) More... | |
void | drawImage (int x, int y, const mrpt::img::CImage &img) override |
Draws an image as a bitmap at a given position. More... | |
void | line (int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1, TPenStyle penStyle=psSolid) override |
Draws a line. More... | |
void | textOut (int x0, int y0, const std::string &str, const mrpt::img::TColor color) override |
Places a text label. More... | |
virtual void | selectVectorTextFont (const std::string &fontName, int fontSize, bool bold=false, bool italic=false) |
Select the current font used when drawing text. More... | |
void | drawImage (int x, int y, const mrpt::img::CImage &img, float rotation, float scale) override |
Draws an image as a bitmap at a given position, with some custom scale and rotation changes. More... | |
virtual void | rectangle (int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1) |
Draws a rectangle (an empty rectangle, without filling) More... | |
template<class T > | |
void | ellipseGaussian (mrpt::math::CMatrixDynamic< T > *cov2D, T mean_x, T mean_y, float confIntervalStds=2, const mrpt::img::TColor &color=mrpt::img::TColor(255, 255, 255), unsigned int width=1, int nEllipsePoints=20) |
Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution. More... | |
void | triangle (int x0, int y0, int size, const mrpt::img::TColor color, bool inferior=true, unsigned int width=1) |
Draws a triangle. More... | |
virtual void | filledRectangle (int x0, int y0, int x1, int y1, const mrpt::img::TColor color) |
Draws a filled rectangle. More... | |
virtual void | selectTextFont (const std::string &fontName) |
Select the current font used when drawing text. More... | |
void | drawMark (int x0, int y0, const mrpt::img::TColor color, char type, int size=5, unsigned int width=1) |
Draw a mark. More... | |
virtual void | drawCircle (int x, int y, int radius, const mrpt::img::TColor &color=mrpt::img::TColor(255, 255, 255), unsigned int width=1) |
Draws a circle of a given radius. More... | |
void | ellipseGaussian (const mrpt::math::CMatrixFixed< double, 2, 2 > &cov2D, const double mean_x, const double mean_y, double confIntervalStds=2, const mrpt::img::TColor &color=mrpt::img::TColor(255, 255, 255), unsigned int width=1, int nEllipsePoints=20) |
Draws an ellipse representing a given confidence interval of a 2D Gaussian distribution. More... | |
template<class FEATURELIST > | |
void | drawFeaturesSimple (const FEATURELIST &list, const TColor &color=TColor::red(), const int cross_size=5) |
Draws a set of marks onto the image, given a generic container of entities having just "x" and "y" fields. More... | |
template<class FEATURELIST > | |
void | drawFeatures (const FEATURELIST &list, const TColor &color=TColor::red(), const bool showIDs=false, const bool showResponse=false, const bool showScale=false, const char marker='+') |
Draws a set of marks (or scaled circles for features with scale) onto the image, given a generic container of features. More... | |
Static Public Member Functions | |
static void | LINUX_IMG_WIDTH (int value) |
In Linux, the size of the bitmap image that emulates the EMF (Default:800) More... | |
static int | LINUX_IMG_WIDTH () |
static void | LINUX_IMG_HEIGHT (int value) |
In Linux, the size of the bitmap image that emulates the EMF (Default:600) More... | |
static int | LINUX_IMG_HEIGHT () |
Protected Attributes | |
std::string | m_selectedFont {"9x15"} |
The selected font name. More... | |
const uint32_t * | m_selectedFontBitmaps {nullptr} |
Direct access to character bitmaps. More... | |
Private Attributes | |
void_ptr_noncopy | m_hdc |
int | m_scale |
void_ptr_noncopy | m_hFont {nullptr} |
std::string | m_targetFile |
|
inherited |
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. |
Definition at line 41 of file CEnhancedMetaFile.cpp.
References mrpt::img::CCanvas::filledRectangle(), mrpt::non_copiable_ptr_basic< T >::get(), LINUX_IMG_HEIGHT_value, LINUX_IMG_WIDTH_value, m_hdc, and THROW_EXCEPTION.
|
override |
Destructor.
Definition at line 61 of file CEnhancedMetaFile.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), m_hdc, m_hFont, and m_targetFile.
|
virtualinherited |
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) |
Reimplemented in mrpt::img::CImage.
Definition at line 338 of file CCanvas.cpp.
References M_2PI, and mrpt::round().
Referenced by mrpt::img::CCanvas::drawFeatures().
|
inlineinherited |
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 280 of file CCanvas.h.
References mrpt::img::CCanvas::drawCircle(), mrpt::img::CCanvas::drawMark(), mrpt::format(), mrpt::img::TColor::red(), mrpt::round(), and mrpt::img::CCanvas::textOut().
Referenced by mrpt::gui::CDisplayWindow::showImageAndPoints().
|
inlineinherited |
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<mrpt::math::TPoint2D>, std::vector<TPixelCoordsf> or mrpt::vision::CFeatureList
Definition at line 259 of file CCanvas.h.
References mrpt::img::CCanvas::drawMark(), and mrpt::round().
|
overridevirtual |
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::img::CCanvas.
Definition at line 84 of file CEnhancedMetaFile.cpp.
References ASSERT_, mrpt::non_copiable_ptr_basic< T >::get(), mrpt::img::CImage::getHeight(), mrpt::img::CImage::getWidth(), m_hdc, m_scale, and THROW_EXCEPTION.
Referenced by mrpt::slam::CMetricMapBuilderICP::saveCurrentEstimationToImage().
|
inlineoverridevirtual |
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::img::CCanvas.
Definition at line 136 of file CEnhancedMetaFile.h.
References mrpt::img::CCanvas::drawImage().
|
inherited |
Draw a mark.
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', '+', ':'(like '+' but clear at the center dot), or 's' (square) |
width | The desired width of the cross (this is IGNORED yet) |
Definition at line 304 of file CCanvas.cpp.
References mrpt::math::size(), and THROW_EXCEPTION.
Referenced by mrpt::img::CCanvas::drawFeatures(), mrpt::img::CCanvas::drawFeaturesSimple(), and mrpt::gui::CDisplayWindow::plot().
|
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 171 of file CEnhancedMetaFile.h.
References line(), M_2PI, MRPT_END_WITH_CLEAN_UP, MRPT_START, and mrpt::round().
|
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 452 of file CCanvas.cpp.
References mrpt::math::MatrixVectorBase< T, CMatrixFixed< T, ROWS, COLS > >::array(), mrpt::math::CMatrixFixed< T, ROWS, COLS >::asEigen(), mrpt::math::MatrixBase< T, CMatrixFixed< T, ROWS, COLS > >::eig(), M_2PI, MRPT_END_WITH_CLEAN_UP, MRPT_START, mrpt::round(), mrpt::math::MatrixBase< T, CMatrixFixed< T, ROWS, COLS > >::setDiagonal(), and mrpt::math::MatrixVectorBase< T, CMatrixFixed< T, ROWS, COLS > >::transpose().
|
virtualinherited |
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. |
Definition at line 205 of file CCanvas.cpp.
References getHeight().
Referenced by mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(), CEnhancedMetaFile(), mrpt::gui::CDisplayWindow::plot(), and mrpt::maps::COccupancyGridMap2D::saveAsBitmapTwoMapsWithCorrespondences().
|
inlineoverridevirtual |
Returns the height of the image in pixels (this currently has no applicability for a EMF file...)
Implements mrpt::img::CCanvas.
Definition at line 71 of file CEnhancedMetaFile.h.
|
inlineoverridevirtual |
Returns the width of the image in pixels (this currently has no applicability for a EMF file...)
Implements mrpt::img::CCanvas.
Definition at line 68 of file CEnhancedMetaFile.h.
|
overridevirtual |
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::img::CCanvas.
Definition at line 167 of file CEnhancedMetaFile.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), m_hdc, and m_scale.
Referenced by ellipseGaussian(), rectangle(), and mrpt::slam::CMetricMapBuilderICP::saveCurrentEstimationToImage().
|
static |
In Linux, the size of the bitmap image that emulates the EMF (Default:600)
Definition at line 33 of file CEnhancedMetaFile.cpp.
References LINUX_IMG_HEIGHT_value.
|
static |
Definition at line 37 of file CEnhancedMetaFile.cpp.
References LINUX_IMG_HEIGHT_value.
|
static |
In Linux, the size of the bitmap image that emulates the EMF (Default:800)
Definition at line 28 of file CEnhancedMetaFile.cpp.
References LINUX_IMG_WIDTH_value.
|
static |
Definition at line 32 of file CEnhancedMetaFile.cpp.
References LINUX_IMG_WIDTH_value.
|
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. |
Definition at line 265 of file CEnhancedMetaFile.cpp.
References line().
|
virtualinherited |
Select the current font used when drawing text.
fontName | The name of the font |
Valid font names:
18x18ja (Asian characters for UTF-8 strings - Only available if MRPT is built with MRPT_HAS_ASIAN_FONTS = true)
Definition at line 220 of file CCanvas.cpp.
References FontData::data, init_fonts_list(), list_registered_fonts, FontData::prepared_to_big_endian, and mrpt::reverseBytesInPlace().
Referenced by mrpt::img::CImage::drawChessboardCorners(), and selectVectorTextFont().
|
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 |
Definition at line 213 of file CEnhancedMetaFile.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), m_hdc, MRPT_TRY_END, MRPT_TRY_START, mrpt::img::CCanvas::selectTextFont(), and mrpt::system::os::strcpy().
|
overridevirtual |
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::img::CCanvas.
Definition at line 253 of file CEnhancedMetaFile.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), m_hdc, and m_scale.
|
overridevirtual |
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::img::CCanvas.
Definition at line 194 of file CEnhancedMetaFile.cpp.
References mrpt::non_copiable_ptr_basic< T >::get(), m_hdc, and m_scale.
|
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. |
Definition at line 181 of file CCanvas.cpp.
References mrpt::round(), and mrpt::math::size().
|
private |
Definition at line 26 of file CEnhancedMetaFile.h.
Referenced by CEnhancedMetaFile(), drawImage(), line(), selectVectorTextFont(), setPixel(), textOut(), and ~CEnhancedMetaFile().
|
private |
Definition at line 28 of file CEnhancedMetaFile.h.
Referenced by ~CEnhancedMetaFile().
|
private |
Definition at line 27 of file CEnhancedMetaFile.h.
Referenced by drawImage(), line(), setPixel(), and textOut().
|
protectedinherited |
|
protectedinherited |
|
private |
Definition at line 29 of file CEnhancedMetaFile.h.
Referenced by ~CEnhancedMetaFile().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: c7a3bec24 Sun Mar 29 18:33:13 2020 +0200 at dom mar 29 18:50:38 CEST 2020 |