39#ifndef DOXYGEN_SHOULD_SKIP_THIS
41#include <visp3/core/vpConfig.h>
43#if (defined(VISP_HAVE_D3D9))
45#ifndef VPD3DRENDERER_HH
46#define VPD3DRENDERER_HH
52#include <visp3/core/vpDisplayException.h>
53#include <visp3/gui/vpWin32Renderer.h>
65class VISP_EXPORT vpD3DRenderer :
public vpWin32Renderer
71 IDirect3DDevice9 *pd3dDevice;
78 IDirect3DTexture9 *pd3dText;
82 IDirect3DTexture9 *pd3dVideoText;
85 unsigned int textWidth;
100 bool init(HWND hwnd,
unsigned int width,
unsigned int height);
104 virtual ~vpD3DRenderer();
106 void setImg(
const vpImage<vpRGBa> &im);
107 void setImg(
const vpImage<unsigned char> &im);
108 void setImgROI(
const vpImage<vpRGBa> &im,
const vpImagePoint &iP,
unsigned int width,
unsigned int height);
109 void setImgROI(
const vpImage<unsigned char> &im,
const vpImagePoint &iP,
unsigned int width,
unsigned int height);
111 void setPixel(
const vpImagePoint &iP,
const vpColor &color);
113 void drawLine(
const vpImagePoint &ip1,
const vpImagePoint &ip2,
const vpColor &color,
unsigned int thickness,
114 int style = PS_SOLID);
116 void drawRect(
const vpImagePoint &topLeft,
unsigned int width,
unsigned int height,
const vpColor &color,
117 bool fill =
false,
unsigned int thickness = 1);
119 void clear(
const vpColor &color);
121 void drawCircle(
const vpImagePoint ¢er,
unsigned int radius,
const vpColor &color,
bool fill =
false,
122 unsigned int thickness = 1);
124 void drawText(
const vpImagePoint &ip,
const char *text,
const vpColor &color);
126 void drawCross(
const vpImagePoint &ip,
unsigned int size,
const vpColor &color,
unsigned int thickness = 1);
128 void drawArrow(
const vpImagePoint &ip1,
const vpImagePoint &ip2,
const vpColor &color,
unsigned int w,
unsigned int h,
129 unsigned int thickness = 1);
131 void getImage(vpImage<vpRGBa> &I);
134 void initView(
float,
float);
140 void subDrawCircle(
int i,
int j,
int x,
int y, vpColor col,
unsigned char *buf,
unsigned int pitch,
unsigned int maxX,
143 void convert(
const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch);
144 void convert(
const vpImage<unsigned char> &I,
unsigned char *imBuffer,
unsigned int pitch);
145 void convertROI(
const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
int j_min,
146 int i_max,
int j_max);
147 void convertROI(
const vpImage<unsigned char> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
int j_min,
148 int i_max,
int j_max);
162 inline void setBufferPixel(
unsigned char *buf,
unsigned int pitch,
int x,
int y,
const vpColor &color,
163 unsigned int maxX,
unsigned int maxY)
167 c = colors[color.
id];
169 c = D3DCOLOR_ARGB(0xFF, color.
R, color.
G, color.
B);
172 if (x >= 0 && y >= 0 && x <= (
int)maxX && y <= (
int)maxY)
173 *(
unsigned long *)(buf + (y * pitch) + (x << 2)) = c;
184 inline void setBufferPixel(
unsigned char *buf,
unsigned int pitch,
int x,
int y,
const vpColor &color)
188 c = colors[color.
id];
190 c = D3DCOLOR_ARGB(0xFF, color.
R, color.
G, color.
B);
193 *(
unsigned long *)(buf + (y * pitch) + (x << 2)) = c;
196 unsigned int supPowerOf2(
unsigned int n);
unsigned char B
Blue component.
unsigned char R
Red component.
unsigned char G
Green component.