34#ifndef VP_D3D_RENDERER_H
35#define VP_D3D_RENDERER_H
37#include <visp3/core/vpConfig.h>
39#ifndef DOXYGEN_SHOULD_SKIP_THIS
40#if (defined(VISP_HAVE_D3D9))
47# pragma clang diagnostic push
48# pragma clang diagnostic ignored "-Wnonportable-system-include-path"
55#include <visp3/core/vpDisplayException.h>
56#include <visp3/gui/vpWin32Renderer.h>
62# pragma clang diagnostic pop
75class VISP_EXPORT vpD3DRenderer :
public vpWin32Renderer
80 IDirect3DDevice9 *pd3dDevice;
87 IDirect3DTexture9 *pd3dText;
91 IDirect3DTexture9 *pd3dVideoText;
94 unsigned int textWidth;
109 bool init(HWND hwnd,
unsigned int width,
unsigned int height);
113 virtual ~vpD3DRenderer() VP_OVERRIDE;
115 void setImg(const vpImage<vpRGBa> &im);
116 void setImg(const vpImage<
unsigned char> &im);
117 void setImgROI(const vpImage<vpRGBa> &im, const vpImagePoint &iP,
unsigned int width,
unsigned int height);
118 void setImgROI(const vpImage<
unsigned char> &im, const vpImagePoint &iP,
unsigned int width,
unsigned int height);
120 void setPixel(const vpImagePoint &iP, const vpColor &color);
122 void drawLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
unsigned int thickness,
123 int style = PS_SOLID);
125 void drawRect(const vpImagePoint &topLeft,
unsigned int width,
unsigned int height, const vpColor &color,
126 bool fill = false,
unsigned int thickness = 1);
128 void clear(const vpColor &color);
130 void drawCircle(const vpImagePoint ¢er,
unsigned int radius, const vpColor &color,
bool fill = false,
131 unsigned int thickness = 1);
133 void drawText(const vpImagePoint &ip, const
char *text, const vpColor &color);
135 void drawCross(const vpImagePoint &ip,
unsigned int size, const vpColor &color,
unsigned int thickness = 1);
137 void drawArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color,
unsigned int w,
unsigned int h,
138 unsigned int thickness = 1);
140 void getImage(vpImage<vpRGBa> &I) VP_OVERRIDE;
143 void initView(
float,
float);
149 void subDrawCircle(
int i,
int j,
int x,
int y, vpColor col,
unsigned char *buf,
unsigned int pitch,
unsigned int maxX,
152 void convert(const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch);
153 void convert(const vpImage<
unsigned char> &I,
unsigned char *imBuffer,
unsigned int pitch);
154 void convertROI(const vpImage<vpRGBa> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
int j_min,
155 int i_max,
int j_max);
156 void convertROI(const vpImage<
unsigned char> &I,
unsigned char *imBuffer,
unsigned int pitch,
int i_min,
int j_min,
157 int i_max,
int j_max);
171 inline
void setBufferPixel(
unsigned char *buf,
unsigned int pitch,
int x,
int y, const vpColor &color,
172 unsigned int maxX,
unsigned int maxY)
176 c = colors[
color.id];
178 c = D3DCOLOR_ARGB(0xFF, color.R, color.G, color.B);
181 if (x >= 0 && y >= 0 && x <=
static_cast<int>(maxX) && y <=
static_cast<int>(maxY))
182 *(
unsigned long *)(buf + (y * pitch) + (x << 2)) = c;
193 inline void setBufferPixel(
unsigned char *buf,
unsigned int pitch,
int x,
int y,
const vpColor &color)
197 c = colors[
color.id];
202 *(
unsigned long *)(buf + (y * pitch) + (x << 2)) = c;
205 unsigned int supPowerOf2(
unsigned int n);