16 #include <mrpt/config.h>    45     : m_scale(scaleFactor), m_targetFile(targetFileName)
    49         CreateEnhMetaFileA(
nullptr, targetFileName.c_str(), 
nullptr, 
nullptr);
    74     DeleteEnhMetaFile(CloseEnhMetaFile((HDC)
m_hdc.
get()));
    91         LPBITMAPINFO pBmpInfo = (LPBITMAPINFO) 
new unsigned char    92             [
sizeof(BITMAPINFOHEADER) + (256 * 
sizeof(RGBQUAD))];
    96         unsigned int imgWidth = (
unsigned int)
img.getWidth();
    97         unsigned int imgHeight = (
unsigned int)
img.getHeight();
    99         pBmpInfo->bmiHeader.biSize = 
sizeof(BITMAPINFOHEADER);
   100         pBmpInfo->bmiHeader.biWidth = imgWidth;
   101         pBmpInfo->bmiHeader.biHeight = imgHeight;
   102         pBmpInfo->bmiHeader.biPlanes = 1;
   104         pBmpInfo->bmiHeader.biBitCount = 8;
   105         pBmpInfo->bmiHeader.biCompression = BI_RGB;
   106         pBmpInfo->bmiHeader.biSizeImage = 0;
   107         pBmpInfo->bmiHeader.biXPelsPerMeter =
   108             pBmpInfo->bmiHeader.biYPelsPerMeter = 0;
   109         pBmpInfo->bmiHeader.biClrUsed = 0;
   110         pBmpInfo->bmiHeader.biClrImportant = 0;
   113         for (
unsigned char i = 0; i < 255; i++)
   115             pBmpInfo->bmiColors[i].rgbRed = i;
   116             pBmpInfo->bmiColors[i].rgbGreen = i;
   117             pBmpInfo->bmiColors[i].rgbBlue = i;
   118             pBmpInfo->bmiColors[i].rgbReserved = 0;
   122         unsigned int lineBytes = imgWidth;
   123         if (lineBytes % 2) lineBytes++;
   124         if (lineBytes % 4) lineBytes += 2;
   126         BYTE* ptrBits = 
new BYTE[lineBytes * imgHeight];
   128         for (
unsigned int py = 0; py < imgHeight; py++)
   129             for (
unsigned int px = 0; px < imgWidth; px++)
   130                 ptrBits[(py * lineBytes + px) + 0] = *
img(px, py);
   132         HBITMAP hBitmap = CreateDIBitmap(
   133             (HDC)
m_hdc.
get(), &pBmpInfo->bmiHeader, CBM_INIT, ptrBits, pBmpInfo,
   139         GetObject(hBitmap, 
sizeof(bm), &bm);
   141         HDC hdcMem = CreateCompatibleDC((HDC)
m_hdc.
get());
   142         HBITMAP hbmT = (HBITMAP)SelectObject(hdcMem, hBitmap);
   146             (int)(
m_scale * imgHeight), hdcMem, 0, 0, SRCCOPY);
   148         SelectObject(hdcMem, hbmT);
   153         DeleteObject(hBitmap);
   179     HPEN hPen = CreatePen(penStyle, 
width, (
unsigned int)
color);
   181     HPEN hOldPen = (HPEN)SelectObject((HDC)
m_hdc.
get(), hPen);
   183     MoveToEx((HDC)
m_hdc.
get(), x0, y0, 
nullptr);
   186     SelectObject((HDC)
m_hdc.
get(), hOldPen);
   203     ::SetBkMode((HDC)
m_hdc.
get(), TRANSPARENT);
   206     ::TextOutA((HDC)
m_hdc.
get(), x0, y0, str.c_str(), (int)str.size());
   216     const std::string& fontName, 
int fontSize, 
bool bold, 
bool italic)
   219     HFONT hFont, oldFont;
   222     lpf.lfHeight = fontSize;
   224     lpf.lfEscapement = 0;
   225     lpf.lfOrientation = 0;
   226     lpf.lfWeight = bold ? 700 : 400;
   227     lpf.lfItalic = italic ? 1 : 0;
   230     lpf.lfCharSet = DEFAULT_CHARSET;
   231     lpf.lfOutPrecision = OUT_DEFAULT_PRECIS;
   232     lpf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
   233     lpf.lfQuality = DEFAULT_QUALITY;
   234     lpf.lfPitchAndFamily = DEFAULT_PITCH;
   235     os::strcpy(lpf.lfFaceName, LF_FACESIZE, fontName.c_str());
   237     hFont = ::CreateFontIndirectA(&lpf);
   239     oldFont = (HFONT)::SelectObject((HDC)
m_hdc.
get(), hFont);
   241     if (oldFont) ::DeleteObject(oldFont);
 
#define MRPT_TRY_END
The end of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ex...
 
TPenStyle
Definition of pen styles. 
 
#define THROW_EXCEPTION(msg)
 
#define MRPT_TRY_START
The start of a standard MRPT "try...catch()" block that allows tracing throw the call stack after an ...
 
#define ASSERT_(f)
Defines an assertion mechanism. 
 
virtual void selectTextFont(const std::string &fontName)
Select the current font used when drawing text. 
 
virtual void filledRectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color)
Draws a filled rectangle. 
 
GLsizei const GLchar ** string
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
GLsizei const GLfloat * value
 
char * strcpy(char *dest, size_t destSize, const char *source) noexcept
An OS-independent version of strcpy. 
 
A class for storing images as grayscale or RGB bitmaps. 
 
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.