ViSP
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Functions
Variables
Enumerations
Enumerator
Friends
Groups
Pages
vpGDIRenderer.h
1
/****************************************************************************
2
*
3
* $Id: vpGDIRenderer.h 4056 2013-01-05 13:04:42Z fspindle $
4
*
5
* This file is part of the ViSP software.
6
* Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7
*
8
* This software is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* ("GPL") version 2 as published by the Free Software Foundation.
11
* See the file LICENSE.txt at the root directory of this source
12
* distribution for additional information about the GNU GPL.
13
*
14
* For using ViSP with software that can not be combined with the GNU
15
* GPL, please contact INRIA about acquiring a ViSP Professional
16
* Edition License.
17
*
18
* See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19
*
20
* This software was developed at:
21
* INRIA Rennes - Bretagne Atlantique
22
* Campus Universitaire de Beaulieu
23
* 35042 Rennes Cedex
24
* France
25
* http://www.irisa.fr/lagadic
26
*
27
* If you have questions regarding the use of this file, please contact
28
* INRIA at visp@inria.fr
29
*
30
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32
*
33
*
34
* Description:
35
* GDI renderer for windows 32 display
36
*
37
* Authors:
38
* Bruno Renier
39
*
40
*****************************************************************************/
41
42
#include <visp/vpConfig.h>
43
44
#if ( defined(VISP_HAVE_GDI) )
45
#ifndef vpGDIRenderer_HH
46
#define vpGDIRenderer_HH
47
48
49
#ifndef DOXYGEN_SHOULD_SKIP_THIS
50
51
#include <windows.h>
52
53
#include <visp/vpWin32Renderer.h>
54
#include <visp/vpImage.h>
55
#include <visp/vpRGBa.h>
56
#include <visp/vpDisplayException.h>
57
58
#include <visp/vpMath.h>
59
60
class
VISP_EXPORT vpGDIRenderer :
public
vpWin32Renderer
61
{
62
//the handle of the associated window
63
HWND hWnd;
64
65
//the bitmap object to display
66
HBITMAP bmp;
67
68
//colors for overlay
69
COLORREF colors[
vpColor::id_unknown
];
70
71
//font used to draw text
72
HFONT hFont;
73
74
//used to ensure that only one thread at a time is accessing bmp
75
CRITICAL_SECTION CriticalSection;
76
77
public
:
78
double
timelost;
79
vpGDIRenderer();
80
virtual
~vpGDIRenderer();
81
82
bool
init(HWND hWnd,
unsigned
int
width,
unsigned
int
height);
83
84
bool
render();
85
86
// gets the image's width.
87
unsigned
int
getImageWidth(){
return
nbCols; }
88
89
// gets the image's height.
90
unsigned
int
getImageHeight(){
return
nbRows; }
91
92
void
setImg(
const
vpImage<vpRGBa>
& I);
93
void
setImg(
const
vpImage<unsigned char>
& I);
94
void
setImgROI(
const
vpImage<vpRGBa>
& I,
const
vpImagePoint
&iP,
const
unsigned
int
width,
const
unsigned
int
height );
95
void
setImgROI(
const
vpImage<unsigned char>
& I,
const
vpImagePoint
&iP,
const
unsigned
int
width,
const
unsigned
int
height );
96
97
void
setPixel(
const
vpImagePoint
&iP,
const
vpColor
&color);
98
99
void
drawLine(
const
vpImagePoint
&ip1,
100
const
vpImagePoint
&ip2,
101
const
vpColor
&color,
unsigned
int
thickness,
int
style=PS_SOLID);
102
103
void
drawRect(
const
vpImagePoint
&topLeft,
104
unsigned
int
width,
unsigned
int
height,
105
const
vpColor
&color,
bool
fill=
false
,
106
unsigned
int
thickness=1);
107
108
void
clear(
const
vpColor
&color);
109
110
void
drawCircle(
const
vpImagePoint
¢er,
unsigned
int
radius,
111
const
vpColor
&color,
bool
fill=
false
,
unsigned
int
thickness=1);
112
113
void
drawText(
const
vpImagePoint
&ip,
const
char
* text,
114
const
vpColor
&color);
115
116
void
drawCross(
const
vpImagePoint
&ip,
unsigned
int
size,
117
const
vpColor
&color,
unsigned
int
thickness=1);
118
119
void
drawArrow(
const
vpImagePoint
&ip1,
120
const
vpImagePoint
&ip2,
121
const
vpColor
&color,
unsigned
int
w,
unsigned
int
h,
unsigned
int
thickness=1);
122
123
void
getImage(
vpImage<vpRGBa>
&I);
124
125
private
:
126
127
//updates the renderer hbitmaps.
128
bool
updateBitmap(HBITMAP& hBmp,
unsigned
char
* imBuffer,
129
unsigned
int
w,
unsigned
int
h);
130
//updates the renderer hbitmaps.
131
bool
updateBitmapROI(
unsigned
char
* imBuffer,
const
vpImagePoint
&iP,
132
unsigned
int
w,
unsigned
int
h);
133
134
135
//converts a vpImage<vpRGBa> into a HBITMAP .
136
void
convert(
const
vpImage<vpRGBa>
&I, HBITMAP& hBmp);
137
138
//converst a vpImage<unsigned char> into a HBITMAP .
139
void
convert(
const
vpImage<unsigned char>
&I, HBITMAP& hBmp);
140
141
//converts a vpImage<vpRGBa> into a HBITMAP .
142
void
convertROI(
const
vpImage<vpRGBa>
&I,
const
vpImagePoint
&iP,
const
unsigned
int
width,
const
unsigned
int
height);
143
144
//converst a vpImage<unsigned char> into a HBITMAP .
145
void
convertROI(
const
vpImage<unsigned char>
&I,
const
vpImagePoint
&iP,
const
unsigned
int
width,
const
unsigned
int
height);
146
147
};
148
#endif
149
#endif
150
#endif
src
device
display
windows
vpGDIRenderer.h
Generated on Tue Sep 17 2013 00:21:36 for ViSP by
1.8.4