36 #include <visp3/core/vpConfig.h>
38 #if (defined(_WIN32) & defined(VISP_HAVE_D3D9))
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 #include <visp3/core/vpColor.h>
42 #include <visp3/core/vpMath.h>
43 #include <visp3/gui/vpD3DRenderer.h>
72 vpD3DRenderer::vpD3DRenderer()
78 pd3dVideoText =
nullptr;
159 hFont = CreateFont(18, 0, 0, 0, FW_NORMAL,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
160 CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
nullptr);
167 vpD3DRenderer::~vpD3DRenderer()
171 if (pd3dDevice !=
nullptr)
172 pd3dDevice->Release();
175 if (pd3dText !=
nullptr)
177 if (pd3dVideoText !=
nullptr)
178 pd3dVideoText->Release();
186 unsigned int vpD3DRenderer::supPowerOf2(
unsigned int n)
193 return static_cast<unsigned int>(1 << (i + 1));
203 bool vpD3DRenderer::init(HWND hwnd,
unsigned int width,
unsigned int height)
211 if (
nullptr == (pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
214 D3DDISPLAYMODE d3ddm;
215 if (FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
218 D3DPRESENT_PARAMETERS d3dpp;
219 ZeroMemory(&d3dpp,
sizeof(d3dpp));
220 d3dpp.BackBufferCount = 1;
221 d3dpp.Windowed = TRUE;
222 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
223 d3dpp.BackBufferFormat = d3ddm.Format;
226 if (FAILED(pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
227 D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, &d3dpp, &pd3dDevice)))
231 pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
234 initView((
float)m_rwidth, (
float)m_rheight);
237 textWidth = supPowerOf2((m_rwidth > m_rheight) ? m_rwidth : m_rheight);
242 if (D3DXCreateTexture(pd3dDevice, textWidth, textWidth, D3DX_DEFAULT, 0, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM,
243 &pd3dText) != D3D_OK) {
248 if (D3DXCreateTexture(pd3dDevice, textWidth, textWidth, D3DX_DEFAULT, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8,
249 D3DPOOL_DEFAULT, &pd3dVideoText) != D3D_OK) {
254 if (D3DXCreateSprite(pd3dDevice, &pSprite) != S_OK)
265 void vpD3DRenderer::initView(
float WindowWidth,
float WindowHeight)
270 D3DXMatrixOrthoLH(&Ortho2D, WindowWidth, WindowHeight, 0.0f, 1.0f);
271 D3DXMatrixIdentity(&Identity);
273 if (pd3dDevice->SetTransform(D3DTS_PROJECTION, &Ortho2D) != D3D_OK ||
274 pd3dDevice->SetTransform(D3DTS_WORLD, &Identity) != D3D_OK ||
275 pd3dDevice->SetTransform(D3DTS_VIEW, &Identity) != D3D_OK)
285 void vpD3DRenderer::convert(
const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch)
288 for (
unsigned int i = 0; i < m_rheight; ++i) {
289 unsigned int ii_ = i * pitch;
290 for (
unsigned int j = 0; j < m_rwidth; ++j) {
292 unsigned int index_ = ii_ + j * 4;
293 imBuffer[index_] = val.
B;
294 imBuffer[++index_] = val.
G;
295 imBuffer[++index_] = val.
R;
296 imBuffer[++index_] = val.
A;
301 for (
unsigned int i = 0; i < m_rheight; ++i) {
302 unsigned int i_ = i * m_rscale;
303 unsigned int ii_ = i * pitch;
304 for (
unsigned int j = 0; j < m_rwidth; ++j) {
305 vpRGBa val = I[i_][j * m_rscale];
306 unsigned int index_ = ii_ + j * 4;
307 imBuffer[index_] = val.
B;
308 imBuffer[++index_] = val.
G;
309 imBuffer[++index_] = val.
R;
310 imBuffer[++index_] = val.
A;
325 for (
unsigned int i = 0; i < m_rheight; ++i) {
326 unsigned int ii_ = i * pitch;
327 for (
unsigned int j = 0; j < m_rwidth; ++j) {
328 unsigned char val = I[i][j];
329 unsigned int index_ = ii_ + j * 4;
330 imBuffer[index_] = val;
331 imBuffer[++index_] = val;
332 imBuffer[++index_] = val;
338 for (
unsigned int i = 0; i < m_rheight; ++i) {
339 unsigned int i_ = i * m_rscale;
340 unsigned int ii_ = i * pitch;
341 for (
unsigned int j = 0; j < m_rwidth; ++j) {
342 unsigned char val = I[i_][j * m_rscale];
343 unsigned int index_ = ii_ + j * 4;
344 imBuffer[index_] = val;
345 imBuffer[++index_] = val;
346 imBuffer[++index_] = val;
361 void vpD3DRenderer::convertROI(
const vpImage<unsigned char> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
362 int j_min,
int i_max,
int j_max)
364 int h = i_max - i_min;
365 int w = j_max - j_min;
368 for (
int i = 0; i < h; ++i) {
369 unsigned int i_ = i_min + i;
370 unsigned int ii_ = i * pitch;
371 for (
int j = 0; j < w; ++j) {
372 unsigned char val = I[i_][j_min + j];
373 unsigned int index_ = ii_ + j * 4;
374 imBuffer[index_] = val;
375 imBuffer[++index_] = val;
376 imBuffer[++index_] = val;
382 for (
int i = 0; i < h; ++i) {
383 unsigned int i_ = (i_min + i) * m_rscale;
384 unsigned int ii_ = i * pitch;
385 for (
int j = 0; j < w; ++j) {
386 unsigned char val = I[i_][(j_min + j) * m_rscale];
387 unsigned int index_ = ii_ + j * 4;
388 imBuffer[index_] = val;
389 imBuffer[++index_] = val;
390 imBuffer[++index_] = val;
405 void vpD3DRenderer::convertROI(
const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
406 int j_min,
int i_max,
int j_max)
408 int h = i_max - i_min;
409 int w = j_max - j_min;
412 for (
int i = 0; i < h; ++i) {
413 unsigned int i_ = i_min + i;
414 unsigned int ii_ = i * pitch;
415 for (
int j = 0; j < w; ++j) {
416 vpRGBa val = I[i_][j_min + j];
417 unsigned int index_ = ii_ + j * 4;
418 imBuffer[index_] = val.
B;
419 imBuffer[++index_] = val.
G;
420 imBuffer[++index_] = val.
R;
426 for (
int i = 0; i < h; ++i) {
427 unsigned int i_ = (i_min + i) * m_rscale;
428 unsigned int ii_ = i * pitch;
429 for (
int j = 0; j < w; ++j) {
430 vpRGBa val = I[i_][(j_min + j) * m_rscale];
431 unsigned int index_ = ii_ + j * 4;
432 imBuffer[index_] = val.
B;
433 imBuffer[++index_] = val.
G;
434 imBuffer[++index_] = val.
R;
448 if (pd3dDevice !=
nullptr) {
449 D3DLOCKED_RECT d3dLRect;
454 r.bottom =
static_cast<signed long>(m_rheight);
455 r.right =
static_cast<signed long>(m_rwidth);
458 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
459 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
464 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
465 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
468 convert(im, buf, pitch);
471 if (pd3dText->UnlockRect(0) != D3D_OK)
472 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
484 if (pd3dDevice !=
nullptr) {
485 D3DLOCKED_RECT d3dLRect;
487 int i_min = std::max<int>((
int)ceil(iP.
get_i() / m_rscale), 0);
488 int j_min = std::max<int>((
int)ceil(iP.
get_j() / m_rscale), 0);
489 int i_max = std::min<int>((
int)ceil((iP.
get_i() + height) / m_rscale), (
int)m_rheight);
490 int j_max = std::min<int>((
int)ceil((iP.
get_j() + width) / m_rscale), (
int)m_rwidth);
494 r.left = (LONG)j_min;
495 r.bottom = (LONG)i_max;
496 r.right = (LONG)j_max;
499 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
500 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
505 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
506 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
509 convertROI(im, buf, pitch, i_min, j_min, i_max, j_max);
512 if (pd3dText->UnlockRect(0) != D3D_OK)
513 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
524 if (pd3dDevice !=
nullptr) {
525 D3DLOCKED_RECT d3dLRect;
530 r.bottom =
static_cast<LONG
>(m_rheight);
531 r.right =
static_cast<LONG
>(m_rwidth);
534 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
535 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
540 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
541 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
544 convert(im, buf, pitch);
547 if (pd3dText->UnlockRect(0) != D3D_OK)
548 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
560 if (pd3dDevice !=
nullptr) {
561 D3DLOCKED_RECT d3dLRect;
563 int i_min = std::max<int>((
int)ceil(iP.
get_i() / m_rscale), 0);
564 int j_min = std::max<int>((
int)ceil(iP.
get_j() / m_rscale), 0);
565 int i_max = std::min<int>((
int)ceil((iP.
get_i() + height) / m_rscale), (
int)m_rheight);
566 int j_max = std::min<int>((
int)ceil((iP.
get_j() + width) / m_rscale), (
int)m_rwidth);
570 r.left = (LONG)j_min;
571 r.bottom = (LONG)i_max;
572 r.right = (LONG)j_max;
575 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
576 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
581 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
582 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
585 convertROI(im, buf, pitch, i_min, j_min, i_max, j_max);
588 if (pd3dText->UnlockRect(0) != D3D_OK)
589 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
598 bool vpD3DRenderer::render()
605 pd3dDevice->BeginScene();
611 r.bottom =
static_cast<LONG
>(m_rheight);
612 r.right =
static_cast<LONG
>(m_rwidth);
616 pd3dDevice->UpdateTexture(pd3dText, pd3dVideoText);
620 #if (D3DX_SDK_VERSION <= 9)
622 pSprite->Draw(pd3dVideoText, &r,
nullptr,
nullptr,
nullptr,
nullptr, 0xFFFFFFFF);
625 pSprite->Draw(pd3dVideoText, &r,
nullptr,
nullptr, 0xFFFFFFFF);
630 pd3dDevice->EndScene();
632 pd3dDevice->Present(
nullptr,
nullptr,
nullptr,
nullptr);
646 if (iPscaled.
get_i() < 0 || iPscaled.
get_j() < 0 || iPscaled.
get_i() >= (
int)m_rheight ||
647 iPscaled.
get_j() >= (
int)m_rwidth) {
652 if (pd3dDevice !=
nullptr) {
653 D3DLOCKED_RECT d3dLRect;
657 r.top = (LONG)iPscaled.
get_i();
658 r.left = (LONG)iPscaled.
get_j();
659 r.bottom = (LONG)iPscaled.
get_i() + 1;
660 r.right = (LONG)iPscaled.
get_j() + 1;
663 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
664 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
669 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
670 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
673 setBufferPixel(buf, pitch, 0, 0, color);
676 if (pd3dText->UnlockRect(0) != D3D_OK)
677 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
689 unsigned int thickness,
int style)
692 if (pd3dDevice !=
nullptr) {
697 IDirect3DSurface9 *pd3dSurf;
698 pd3dText->GetSurfaceLevel(0, &pd3dSurf);
701 pd3dSurf->GetDC(&hDCMem);
706 hPen = CreatePen(style,
static_cast<int>(thickness), colorsGDI[color.
id]);
708 COLORREF gdicolor = RGB(color.
R, color.
G, color.
B);
709 hPen = CreatePen(style,
static_cast<int>(thickness), gdicolor);
713 SetBkMode(hDCMem, TRANSPARENT);
716 SelectObject(hDCMem, hPen);
721 if (thickness != 1 && style != PS_SOLID) {
725 double size = 10. * m_rscale;
727 bool vertical_line = (int)ip2_.
get_j() == (int)ip1_.
get_j();
730 std::swap(ip1_, ip2_);
734 std::swap(ip1_, ip2_);
737 double diff_j = vertical_line ? 1 : ip2_.
get_j() - ip1_.
get_j();
738 double deltaj = size / length * diff_j;
739 double deltai = size / length * (ip2_.
get_i() - ip1_.
get_i());
740 double slope = (ip2_.
get_i() - ip1_.
get_i()) / diff_j;
741 double orig = ip1_.
get_i() - slope * ip1_.
get_j();
744 for (
unsigned int i = (
unsigned int)ip1_.
get_i(); i < ip2_.
get_i(); i += (
unsigned int)(2 * deltai)) {
745 double j = ip1_.
get_j();
754 for (
unsigned int j = (
unsigned int)ip1_.
get_j(); j < ip2_.
get_j(); j += (
unsigned int)(2 * deltaj)) {
755 double i = slope * j + orig;
771 pd3dSurf->ReleaseDC(hDCMem);
788 void vpD3DRenderer::drawRect(
const vpImagePoint &topLeft,
unsigned int width,
unsigned int height,
const vpColor &color,
789 bool fill,
unsigned int thickness)
792 if (pd3dDevice !=
nullptr) {
794 drawLine(topLeft, topLeft +
vpImagePoint(0, width), color, thickness);
797 drawLine(topLeft +
vpImagePoint(height, 0), topLeft, color, thickness);
801 unsigned int widthScaled = width / m_rscale;
802 unsigned int heightScaled = height / m_rscale;
804 if (topLeftScaled.
get_i() > (
int)m_rheight - 1 || topLeftScaled.
get_j() > (
int)m_rwidth - 1 ||
805 topLeftScaled.
get_i() + height < 0 || topLeftScaled.
get_j() + width < 0) {
809 D3DLOCKED_RECT d3dLRect;
812 r.top = (LONG)((topLeftScaled.
get_i() > 0) ? topLeftScaled.
get_i() : 0);
813 r.left = (LONG)((topLeftScaled.
get_j() > 0) ? topLeftScaled.
get_j() : 0);
814 r.bottom = (LONG)((topLeftScaled.
get_i() + heightScaled < (int)m_rheight) ? topLeftScaled.
get_i() + heightScaled
816 r.right = (LONG)((topLeftScaled.
get_j() + widthScaled < (int)m_rwidth) ? topLeftScaled.
get_j() + widthScaled
819 int rectW = r.right - r.left;
820 int rectH = r.bottom - r.top;
823 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
824 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
829 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
830 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
832 if (topLeftScaled.
get_i() >= 0 && topLeftScaled.
get_j() + widthScaled < m_rwidth &&
833 topLeftScaled.
get_i() + heightScaled < m_rheight && topLeftScaled.
get_j() >= 0) {
834 for (
int x = 0; x < rectW; ++x) {
835 for (
int y = 0; y < rectH; ++y)
836 setBufferPixel(buf, pitch, x, y, color);
841 if (pd3dText->UnlockRect(0) != D3D_OK)
842 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
851 void vpD3DRenderer::clear(
const vpColor &color)
854 if (pd3dDevice !=
nullptr) {
855 D3DLOCKED_RECT d3dLRect;
860 r.bottom =
static_cast<LONG
>(m_rheight);
861 r.right =
static_cast<LONG
>(m_rwidth);
864 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
865 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
870 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
871 long *buf = (
long *)(d3dLRect.pBits);
875 c = colors[color.
id];
877 c = D3DCOLOR_ARGB(0xFF, color.
R, color.
G, color.
B);
879 long *end = (
long *)(buf + (pitch * m_rheight));
883 *buf++ =
static_cast<long>(c);
886 if (pd3dText->UnlockRect(0) != D3D_OK)
887 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
893 void vpD3DRenderer::subDrawCircle(
int i,
int j,
int x,
int y,
vpColor col,
unsigned char *buf,
unsigned int pitch,
894 unsigned int maxX,
unsigned int maxY)
897 setBufferPixel(buf, pitch, i, j + y, col, maxX, maxY);
898 setBufferPixel(buf, pitch, i, j - y, col, maxX, maxY);
899 setBufferPixel(buf, pitch, i + y, j, col, maxX, maxY);
900 setBufferPixel(buf, pitch, i - y, j, col, maxX, maxY);
903 setBufferPixel(buf, pitch, i + x, j + y, col, maxX, maxY);
904 setBufferPixel(buf, pitch, i - x, j + y, col, maxX, maxY);
905 setBufferPixel(buf, pitch, i + x, j - y, col, maxX, maxY);
906 setBufferPixel(buf, pitch, i - x, j - y, col, maxX, maxY);
909 setBufferPixel(buf, pitch, i + x, j + y, col, maxX, maxY);
910 setBufferPixel(buf, pitch, i - x, j + y, col, maxX, maxY);
911 setBufferPixel(buf, pitch, i + x, j - y, col, maxX, maxY);
912 setBufferPixel(buf, pitch, i - x, j - y, col, maxX, maxY);
913 setBufferPixel(buf, pitch, i + y, j + x, col, maxX, maxY);
914 setBufferPixel(buf, pitch, i - y, j + x, col, maxX, maxY);
915 setBufferPixel(buf, pitch, i + y, j - x, col, maxX, maxY);
916 setBufferPixel(buf, pitch, i - y, j - x, col, maxX, maxY);
926 void vpD3DRenderer::drawCircle(
const vpImagePoint ¢er,
unsigned int radius,
const vpColor &color,
bool ,
929 unsigned int radiusScaled = radius / m_rscale;
938 if (pd3dDevice !=
nullptr) {
939 D3DLOCKED_RECT d3dLRect;
942 int radiusScaled_ =
static_cast<int>(radiusScaled);
952 rec.bottom = (LONG)((
vpMath::round(centerScaled.
get_i() + radiusScaled_) < (int)m_rheight)
953 ? centerScaled.
get_i() + radiusScaled_
955 rec.right = (LONG)((
vpMath::round(centerScaled.
get_j() + radiusScaled_) < (
int)m_rwidth)
956 ? centerScaled.
get_j() + radiusScaled_
960 unsigned int rectW =
static_cast<unsigned int>(rec.right - rleft);
961 unsigned int rectH =
static_cast<unsigned int>(rec.bottom - rtop);
964 if (pd3dText->LockRect(0, &d3dLRect, &rec, 0) != D3D_OK) {
965 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
970 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
971 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
976 int y =
static_cast<int>(radiusScaled);
977 int p = (3 - (y << 1));
987 p += ((x << 1) + 1) << 1;
991 p += (((x - y) << 1) + 1) << 1;
997 if (pd3dText->UnlockRect(0) != D3D_OK)
998 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
1008 void vpD3DRenderer::drawText(
const vpImagePoint &ip,
const char *text,
const vpColor &color)
1014 IDirect3DSurface9 *pd3dSurf;
1015 pd3dText->GetSurfaceLevel(0, &pd3dSurf);
1018 pd3dSurf->GetDC(&hDCMem);
1021 SelectObject(hDCMem, hFont);
1025 SetTextColor(hDCMem, colorsGDI[color.
id]);
1027 COLORREF gdicolor = RGB(color.
R, color.
G, color.
B);
1028 SetTextColor(hDCMem, gdicolor);
1032 SetBkMode(hDCMem, TRANSPARENT);
1035 int length = (int)strlen(text);
1038 GetTextExtentPoint32(hDCMem, text, length, &size);
1044 pd3dSurf->ReleaseDC(hDCMem);
1046 pd3dSurf->Release();
1048 DeleteObject(hFont);
1058 void vpD3DRenderer::drawCross(
const vpImagePoint &ip,
unsigned int size,
const vpColor &color,
unsigned int thickness)
1060 double i = ip.
get_i();
1061 double j = ip.
get_j();
1064 ip1.
set_i(i - size / 2);
1066 ip2.
set_i(i + size / 2);
1068 drawLine(ip1, ip2, color, thickness);
1071 ip1.
set_j(j - size / 2);
1073 ip2.
set_j(j + size / 2);
1075 drawLine(ip1, ip2, color, thickness);
1086 unsigned int h,
unsigned int thickness)
1093 if ((std::fabs(a) <= std::numeric_limits<double>::epsilon()) &&
1094 (std::fabs(b) <= std::numeric_limits<double>::epsilon())) {
1110 drawLine(ip2, ip4, color, thickness);
1116 drawLine(ip2, ip4, color, thickness);
1118 drawLine(ip1, ip2, color, thickness);
1128 void TextureToRGBa(
vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch)
1141 I.
bitmap[i].B = imBuffer[k + 0];
1142 I.
bitmap[i].G = imBuffer[k + 1];
1143 I.
bitmap[i].R = imBuffer[k + 2];
1144 I.
bitmap[i].A = imBuffer[k + 3];
1158 if (pd3dDevice !=
nullptr) {
1161 I.
resize(m_rheight, m_rwidth);
1163 D3DLOCKED_RECT d3dLRect;
1168 r.bottom =
static_cast<LONG
>(m_rheight);
1169 r.right =
static_cast<LONG
>(m_rwidth);
1172 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
1173 std::cout <<
"D3D : Couldn't lock the texture!" << std::endl;
1178 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
1179 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
1182 TextureToRGBa(I, buf, pitch);
1185 if (pd3dText->UnlockRect(0) != D3D_OK)
1186 std::cout <<
"D3D : Couldn't unlock the texture!" << std::endl;
1192 #elif !defined(VISP_BUILD_SHARED_LIBS)
1194 void dummy_vpD3DRenderer() { };
Class to define RGB colors available for display functionalities.
static const vpColor white
static const vpColor darkGray
static const vpColor cyan
static const vpColor orange
static const vpColor darkRed
static const vpColor blue
static const vpColor lightGray
static const vpColor lightBlue
static const vpColor darkGreen
static const vpColor darkBlue
static const vpColor purple
static const vpColor lightGreen
static const vpColor yellow
static const vpColor lightRed
static const vpColor black
static const vpColor green
static const vpColor gray
Error that can be emitted by the vpDisplay class and its derivatives.
@ notInitializedError
Display not initialized.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static double distance(const vpImagePoint &iP1, const vpImagePoint &iP2)
unsigned int getWidth() const
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
Type * bitmap
points toward the bitmap
unsigned int getHeight() const
static double sqr(double x)
static int round(double x)
unsigned char B
Blue component.
unsigned char R
Red component.
unsigned char G
Green component.
unsigned char A
Additionnal component.