38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
42 #include <visp3/core/vpConfig.h>
43 #if (defined(_WIN32) & defined(VISP_HAVE_D3D9))
45 #include <visp3/core/vpColor.h>
46 #include <visp3/core/vpMath.h>
47 #include <visp3/gui/vpD3DRenderer.h>
74 vpD3DRenderer::vpD3DRenderer()
80 pd3dVideoText =
nullptr;
161 hFont = CreateFont(18, 0, 0, 0, FW_NORMAL,
false,
false,
false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
162 CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
nullptr);
169 vpD3DRenderer::~vpD3DRenderer()
173 if (pd3dDevice !=
nullptr)
174 pd3dDevice->Release();
177 if (pd3dText !=
nullptr)
179 if (pd3dVideoText !=
nullptr)
180 pd3dVideoText->Release();
188 unsigned int vpD3DRenderer::supPowerOf2(
unsigned int n)
195 return static_cast<unsigned int>(1 << (i + 1));
205 bool vpD3DRenderer::init(HWND hwnd,
unsigned int width,
unsigned int height)
213 if (
nullptr == (pD3D = Direct3DCreate9(D3D_SDK_VERSION)))
216 D3DDISPLAYMODE d3ddm;
217 if (FAILED(pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
220 D3DPRESENT_PARAMETERS d3dpp;
221 ZeroMemory(&d3dpp,
sizeof(d3dpp));
222 d3dpp.BackBufferCount = 1;
223 d3dpp.Windowed = TRUE;
224 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
225 d3dpp.BackBufferFormat = d3ddm.Format;
228 if (FAILED(pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
229 D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED, &d3dpp, &pd3dDevice)))
233 pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
236 initView((
float)m_rwidth, (
float)m_rheight);
239 textWidth = supPowerOf2((m_rwidth > m_rheight) ? m_rwidth : m_rheight);
244 if (D3DXCreateTexture(pd3dDevice, textWidth, textWidth, D3DX_DEFAULT, 0, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM,
245 &pd3dText) != D3D_OK) {
250 if (D3DXCreateTexture(pd3dDevice, textWidth, textWidth, D3DX_DEFAULT, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8,
251 D3DPOOL_DEFAULT, &pd3dVideoText) != D3D_OK) {
256 if (D3DXCreateSprite(pd3dDevice, &pSprite) != S_OK)
267 void vpD3DRenderer::initView(
float WindowWidth,
float WindowHeight)
272 D3DXMatrixOrthoLH(&Ortho2D, WindowWidth, WindowHeight, 0.0f, 1.0f);
273 D3DXMatrixIdentity(&Identity);
275 if (pd3dDevice->SetTransform(D3DTS_PROJECTION, &Ortho2D) != D3D_OK ||
276 pd3dDevice->SetTransform(D3DTS_WORLD, &Identity) != D3D_OK ||
277 pd3dDevice->SetTransform(D3DTS_VIEW, &Identity) != D3D_OK)
287 void vpD3DRenderer::convert(
const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch)
290 for (
unsigned int i = 0; i < m_rheight; ++i) {
291 unsigned int ii_ = i * pitch;
292 for (
unsigned int j = 0; j < m_rwidth; ++j) {
294 unsigned int index_ = ii_ + j * 4;
295 imBuffer[index_] = val.
B;
296 imBuffer[++index_] = val.
G;
297 imBuffer[++index_] = val.
R;
298 imBuffer[++index_] = val.
A;
303 for (
unsigned int i = 0; i < m_rheight; ++i) {
304 unsigned int i_ = i * m_rscale;
305 unsigned int ii_ = i * pitch;
306 for (
unsigned int j = 0; j < m_rwidth; ++j) {
307 vpRGBa val = I[i_][j * m_rscale];
308 unsigned int index_ = ii_ + j * 4;
309 imBuffer[index_] = val.
B;
310 imBuffer[++index_] = val.
G;
311 imBuffer[++index_] = val.
R;
312 imBuffer[++index_] = val.
A;
327 for (
unsigned int i = 0; i < m_rheight; ++i) {
328 unsigned int ii_ = i * pitch;
329 for (
unsigned int j = 0; j < m_rwidth; ++j) {
330 unsigned char val = I[i][j];
331 unsigned int index_ = ii_ + j * 4;
332 imBuffer[index_] = val;
333 imBuffer[++index_] = val;
334 imBuffer[++index_] = val;
340 for (
unsigned int i = 0; i < m_rheight; ++i) {
341 unsigned int i_ = i * m_rscale;
342 unsigned int ii_ = i * pitch;
343 for (
unsigned int j = 0; j < m_rwidth; ++j) {
344 unsigned char val = I[i_][j * m_rscale];
345 unsigned int index_ = ii_ + j * 4;
346 imBuffer[index_] = val;
347 imBuffer[++index_] = val;
348 imBuffer[++index_] = val;
363 void vpD3DRenderer::convertROI(
const vpImage<unsigned char> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
364 int j_min,
int i_max,
int j_max)
366 int h = i_max - i_min;
367 int w = j_max - j_min;
370 for (
int i = 0; i < h; ++i) {
371 unsigned int i_ = i_min + i;
372 unsigned int ii_ = i * pitch;
373 for (
int j = 0; j < w; ++j) {
374 unsigned char val = I[i_][j_min + j];
375 unsigned int index_ = ii_ + j * 4;
376 imBuffer[index_] = val;
377 imBuffer[++index_] = val;
378 imBuffer[++index_] = val;
384 for (
int i = 0; i < h; ++i) {
385 unsigned int i_ = (i_min + i) * m_rscale;
386 unsigned int ii_ = i * pitch;
387 for (
int j = 0; j < w; ++j) {
388 unsigned char val = I[i_][(j_min + j) * m_rscale];
389 unsigned int index_ = ii_ + j * 4;
390 imBuffer[index_] = val;
391 imBuffer[++index_] = val;
392 imBuffer[++index_] = val;
407 void vpD3DRenderer::convertROI(
const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
408 int j_min,
int i_max,
int j_max)
410 int h = i_max - i_min;
411 int w = j_max - j_min;
414 for (
int i = 0; i < h; ++i) {
415 unsigned int i_ = i_min + i;
416 unsigned int ii_ = i * pitch;
417 for (
int j = 0; j < w; ++j) {
418 vpRGBa val = I[i_][j_min + j];
419 unsigned int index_ = ii_ + j * 4;
420 imBuffer[index_] = val.
B;
421 imBuffer[++index_] = val.
G;
422 imBuffer[++index_] = val.
R;
428 for (
int i = 0; i < h; ++i) {
429 unsigned int i_ = (i_min + i) * m_rscale;
430 unsigned int ii_ = i * pitch;
431 for (
int j = 0; j < w; ++j) {
432 vpRGBa val = I[i_][(j_min + j) * m_rscale];
433 unsigned int index_ = ii_ + j * 4;
434 imBuffer[index_] = val.
B;
435 imBuffer[++index_] = val.
G;
436 imBuffer[++index_] = val.
R;
450 if (pd3dDevice !=
nullptr) {
451 D3DLOCKED_RECT d3dLRect;
456 r.bottom =
static_cast<signed long>(m_rheight);
457 r.right =
static_cast<signed long>(m_rwidth);
460 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
461 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
466 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
467 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
470 convert(im, buf, pitch);
473 if (pd3dText->UnlockRect(0) != D3D_OK)
474 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
486 if (pd3dDevice !=
nullptr) {
487 D3DLOCKED_RECT d3dLRect;
489 int i_min = std::max<int>((
int)ceil(iP.
get_i() / m_rscale), 0);
490 int j_min = std::max<int>((
int)ceil(iP.
get_j() / m_rscale), 0);
491 int i_max = std::min<int>((
int)ceil((iP.
get_i() + height) / m_rscale), (
int)m_rheight);
492 int j_max = std::min<int>((
int)ceil((iP.
get_j() + width) / m_rscale), (
int)m_rwidth);
496 r.left = (LONG)j_min;
497 r.bottom = (LONG)i_max;
498 r.right = (LONG)j_max;
501 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
502 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
507 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
508 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
511 convertROI(im, buf, pitch, i_min, j_min, i_max, j_max);
514 if (pd3dText->UnlockRect(0) != D3D_OK)
515 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
526 if (pd3dDevice !=
nullptr) {
527 D3DLOCKED_RECT d3dLRect;
532 r.bottom =
static_cast<LONG
>(m_rheight);
533 r.right =
static_cast<LONG
>(m_rwidth);
536 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
537 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
542 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
543 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
546 convert(im, buf, pitch);
549 if (pd3dText->UnlockRect(0) != D3D_OK)
550 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
562 if (pd3dDevice !=
nullptr) {
563 D3DLOCKED_RECT d3dLRect;
565 int i_min = std::max<int>((
int)ceil(iP.
get_i() / m_rscale), 0);
566 int j_min = std::max<int>((
int)ceil(iP.
get_j() / m_rscale), 0);
567 int i_max = std::min<int>((
int)ceil((iP.
get_i() + height) / m_rscale), (
int)m_rheight);
568 int j_max = std::min<int>((
int)ceil((iP.
get_j() + width) / m_rscale), (
int)m_rwidth);
572 r.left = (LONG)j_min;
573 r.bottom = (LONG)i_max;
574 r.right = (LONG)j_max;
577 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
578 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
583 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
584 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
587 convertROI(im, buf, pitch, i_min, j_min, i_max, j_max);
590 if (pd3dText->UnlockRect(0) != D3D_OK)
591 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
600 bool vpD3DRenderer::render()
607 pd3dDevice->BeginScene();
613 r.bottom =
static_cast<LONG
>(m_rheight);
614 r.right =
static_cast<LONG
>(m_rwidth);
618 pd3dDevice->UpdateTexture(pd3dText, pd3dVideoText);
622 #if (D3DX_SDK_VERSION <= 9)
624 pSprite->Draw(pd3dVideoText, &r,
nullptr,
nullptr,
nullptr,
nullptr, 0xFFFFFFFF);
627 pSprite->Draw(pd3dVideoText, &r,
nullptr,
nullptr, 0xFFFFFFFF);
632 pd3dDevice->EndScene();
634 pd3dDevice->Present(
nullptr,
nullptr,
nullptr,
nullptr);
648 if (iPscaled.
get_i() < 0 || iPscaled.
get_j() < 0 || iPscaled.
get_i() >= (
int)m_rheight ||
649 iPscaled.
get_j() >= (
int)m_rwidth) {
654 if (pd3dDevice !=
nullptr) {
655 D3DLOCKED_RECT d3dLRect;
659 r.top = (LONG)iPscaled.
get_i();
660 r.left = (LONG)iPscaled.
get_j();
661 r.bottom = (LONG)iPscaled.
get_i() + 1;
662 r.right = (LONG)iPscaled.
get_j() + 1;
665 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
666 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
671 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
672 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
675 setBufferPixel(buf, pitch, 0, 0, color);
678 if (pd3dText->UnlockRect(0) != D3D_OK)
679 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
691 unsigned int thickness,
int style)
694 if (pd3dDevice !=
nullptr) {
699 IDirect3DSurface9 *pd3dSurf;
700 pd3dText->GetSurfaceLevel(0, &pd3dSurf);
703 pd3dSurf->GetDC(&hDCMem);
708 hPen = CreatePen(style,
static_cast<int>(thickness), colorsGDI[color.
id]);
710 COLORREF gdicolor = RGB(color.
R, color.
G, color.
B);
711 hPen = CreatePen(style,
static_cast<int>(thickness), gdicolor);
715 SetBkMode(hDCMem, TRANSPARENT);
718 SelectObject(hDCMem, hPen);
723 if (thickness != 1 && style != PS_SOLID) {
727 double size = 10. * m_rscale;
729 bool vertical_line = (int)ip2_.
get_j() == (int)ip1_.
get_j();
732 std::swap(ip1_, ip2_);
736 std::swap(ip1_, ip2_);
739 double diff_j = vertical_line ? 1 : ip2_.
get_j() - ip1_.
get_j();
740 double deltaj = size / length * diff_j;
741 double deltai = size / length * (ip2_.
get_i() - ip1_.
get_i());
742 double slope = (ip2_.
get_i() - ip1_.
get_i()) / diff_j;
743 double orig = ip1_.
get_i() - slope * ip1_.
get_j();
746 for (
unsigned int i = (
unsigned int)ip1_.
get_i(); i < ip2_.
get_i(); i += (
unsigned int)(2 * deltai)) {
747 double j = ip1_.
get_j();
756 for (
unsigned int j = (
unsigned int)ip1_.
get_j(); j < ip2_.
get_j(); j += (
unsigned int)(2 * deltaj)) {
757 double i = slope * j + orig;
773 pd3dSurf->ReleaseDC(hDCMem);
790 void vpD3DRenderer::drawRect(
const vpImagePoint &topLeft,
unsigned int width,
unsigned int height,
const vpColor &color,
791 bool fill,
unsigned int thickness)
794 if (pd3dDevice !=
nullptr) {
796 drawLine(topLeft, topLeft +
vpImagePoint(0, width), color, thickness);
799 drawLine(topLeft +
vpImagePoint(height, 0), topLeft, color, thickness);
803 unsigned int widthScaled = width / m_rscale;
804 unsigned int heightScaled = height / m_rscale;
806 if (topLeftScaled.
get_i() > (
int)m_rheight - 1 || topLeftScaled.
get_j() > (
int)m_rwidth - 1 ||
807 topLeftScaled.
get_i() + height < 0 || topLeftScaled.
get_j() + width < 0) {
812 D3DLOCKED_RECT d3dLRect;
815 r.top = (LONG)((topLeftScaled.
get_i() > 0) ? topLeftScaled.
get_i() : 0);
816 r.left = (LONG)((topLeftScaled.
get_j() > 0) ? topLeftScaled.
get_j() : 0);
817 r.bottom = (LONG)((topLeftScaled.
get_i() + heightScaled < (int)m_rheight) ? topLeftScaled.
get_i() + heightScaled
819 r.right = (LONG)((topLeftScaled.
get_j() + widthScaled < (int)m_rwidth) ? topLeftScaled.
get_j() + widthScaled
822 int rectW = r.right - r.left;
823 int rectH = r.bottom - r.top;
826 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
827 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
832 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
833 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
835 if (topLeftScaled.
get_i() >= 0 && topLeftScaled.
get_j() + widthScaled < m_rwidth &&
836 topLeftScaled.
get_i() + heightScaled < m_rheight && topLeftScaled.
get_j() >= 0) {
837 for (
int x = 0; x < rectW; ++x) {
838 for (
int y = 0; y < rectH; ++y)
839 setBufferPixel(buf, pitch, x, y, color);
844 if (pd3dText->UnlockRect(0) != D3D_OK)
845 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
854 void vpD3DRenderer::clear(
const vpColor &color)
857 if (pd3dDevice !=
nullptr) {
858 D3DLOCKED_RECT d3dLRect;
863 r.bottom =
static_cast<LONG
>(m_rheight);
864 r.right =
static_cast<LONG
>(m_rwidth);
867 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
868 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
873 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
874 long *buf = (
long *)(d3dLRect.pBits);
878 c = colors[color.
id];
880 c = D3DCOLOR_ARGB(0xFF, color.
R, color.
G, color.
B);
882 long *end = (
long *)(buf + (pitch * m_rheight));
886 *buf++ =
static_cast<long>(c);
889 if (pd3dText->UnlockRect(0) != D3D_OK)
890 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
896 void vpD3DRenderer::subDrawCircle(
int i,
int j,
int x,
int y,
vpColor col,
unsigned char *buf,
unsigned int pitch,
897 unsigned int maxX,
unsigned int maxY)
900 setBufferPixel(buf, pitch, i, j + y, col, maxX, maxY);
901 setBufferPixel(buf, pitch, i, j - y, col, maxX, maxY);
902 setBufferPixel(buf, pitch, i + y, j, col, maxX, maxY);
903 setBufferPixel(buf, pitch, i - y, j, col, maxX, maxY);
906 setBufferPixel(buf, pitch, i + x, j + y, col, maxX, maxY);
907 setBufferPixel(buf, pitch, i - x, j + y, col, maxX, maxY);
908 setBufferPixel(buf, pitch, i + x, j - y, col, maxX, maxY);
909 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 - x, j + y, col, maxX, maxY);
914 setBufferPixel(buf, pitch, i + x, j - y, col, maxX, maxY);
915 setBufferPixel(buf, pitch, i - x, j - y, col, maxX, maxY);
916 setBufferPixel(buf, pitch, i + y, j + x, col, maxX, maxY);
917 setBufferPixel(buf, pitch, i - y, j + x, col, maxX, maxY);
918 setBufferPixel(buf, pitch, i + y, j - x, col, maxX, maxY);
919 setBufferPixel(buf, pitch, i - y, j - x, col, maxX, maxY);
929 void vpD3DRenderer::drawCircle(
const vpImagePoint ¢er,
unsigned int radius,
const vpColor &color,
bool ,
932 unsigned int radiusScaled = radius / m_rscale;
941 if (pd3dDevice !=
nullptr) {
942 D3DLOCKED_RECT d3dLRect;
945 int radiusScaled_ =
static_cast<int>(radiusScaled);
955 rec.bottom = (LONG)((
vpMath::round(centerScaled.
get_i() + radiusScaled_) < (int)m_rheight)
956 ? centerScaled.
get_i() + radiusScaled_
958 rec.right = (LONG)((
vpMath::round(centerScaled.
get_j() + radiusScaled_) < (
int)m_rwidth)
959 ? centerScaled.
get_j() + radiusScaled_
963 unsigned int rectW =
static_cast<unsigned int>(rec.right - rleft);
964 unsigned int rectH =
static_cast<unsigned int>(rec.bottom - rtop);
967 if (pd3dText->LockRect(0, &d3dLRect, &rec, 0) != D3D_OK) {
968 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
973 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
974 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
979 int y =
static_cast<int>(radiusScaled);
980 int p = (3 - (y << 1));
990 p += ((x << 1) + 1) << 1;
994 p += (((x - y) << 1) + 1) << 1;
1000 if (pd3dText->UnlockRect(0) != D3D_OK)
1001 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
1011 void vpD3DRenderer::drawText(
const vpImagePoint &ip,
const char *text,
const vpColor &color)
1017 IDirect3DSurface9 *pd3dSurf;
1018 pd3dText->GetSurfaceLevel(0, &pd3dSurf);
1021 pd3dSurf->GetDC(&hDCMem);
1024 SelectObject(hDCMem, hFont);
1028 SetTextColor(hDCMem, colorsGDI[color.
id]);
1030 COLORREF gdicolor = RGB(color.
R, color.
G, color.
B);
1031 SetTextColor(hDCMem, gdicolor);
1035 SetBkMode(hDCMem, TRANSPARENT);
1038 int length = (int)strlen(text);
1041 GetTextExtentPoint32(hDCMem, text, length, &size);
1047 pd3dSurf->ReleaseDC(hDCMem);
1049 pd3dSurf->Release();
1051 DeleteObject(hFont);
1061 void vpD3DRenderer::drawCross(
const vpImagePoint &ip,
unsigned int size,
const vpColor &color,
unsigned int thickness)
1063 double i = ip.
get_i();
1064 double j = ip.
get_j();
1067 ip1.
set_i(i - size / 2);
1069 ip2.
set_i(i + size / 2);
1071 drawLine(ip1, ip2, color, thickness);
1074 ip1.
set_j(j - size / 2);
1076 ip2.
set_j(j + size / 2);
1078 drawLine(ip1, ip2, color, thickness);
1089 unsigned int h,
unsigned int thickness)
1096 if ((std::fabs(a) <= std::numeric_limits<double>::epsilon()) &&
1097 (std::fabs(b) <= std::numeric_limits<double>::epsilon())) {
1113 drawLine(ip2, ip4, color, thickness);
1119 drawLine(ip2, ip4, color, thickness);
1121 drawLine(ip1, ip2, color, thickness);
1131 void TextureToRGBa(
vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch)
1144 I.
bitmap[i].B = imBuffer[k + 0];
1145 I.
bitmap[i].G = imBuffer[k + 1];
1146 I.
bitmap[i].R = imBuffer[k + 2];
1147 I.
bitmap[i].A = imBuffer[k + 3];
1161 if (pd3dDevice !=
nullptr) {
1164 I.
resize(m_rheight, m_rwidth);
1166 D3DLOCKED_RECT d3dLRect;
1171 r.bottom =
static_cast<LONG
>(m_rheight);
1172 r.right =
static_cast<LONG
>(m_rwidth);
1175 if (pd3dText->LockRect(0, &d3dLRect, &r, 0) != D3D_OK) {
1176 vpCERROR <<
"D3D : Couldn't lock the texture!" << std::endl;
1181 unsigned int pitch =
static_cast<unsigned int>(d3dLRect.Pitch);
1182 unsigned char *buf = (
unsigned char *)d3dLRect.pBits;
1185 TextureToRGBa(I, buf, pitch);
1188 if (pd3dText->UnlockRect(0) != D3D_OK)
1189 vpCERROR <<
"D3D : Couldn't unlock the texture!" << std::endl;
1193 #elif !defined(VISP_BUILD_SHARED_LIBS)
1195 void dummy_vpD3DRenderer() { };
Class to define RGB colors available for display functionalities.
static const vpColor white
static const vpColor darkGray
static const vpColor black
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 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.