1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CD_NATIVEWINDOW</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>
<body>
<h2>CD_NATIVEWINDOW - Native Window Driver (cdnative.h)</h2>
<p>This driver provides access to an existing Native Window, a basic element of the user-interface system. It also
provides access to other native handles like HDC handles in Windows.</p>
<h3>Use</h3>
<p>The canvas is created by means of a call to the function <font face="Courier">
<a href="../func/init.html#cdCreateCanvas"><strong>cdCreateCanvas</strong></a>(CD_NATIVEWINDOW,
Data)</font>, after which other functions in the CD library can be called as usual. This function <b>creates</b> a CD
canvas based on an existing system canvas. The parameter <font face="Courier">Data</font> is a pointer to a handle of
the canvas. It is system-dependent, having a different meaning in each platform:</p>
<p><strong>Microsoft Windows</strong>: can be the handle of the Windows window (<font face="Courier">HWND</font>),
or the handle of a previously created Device Context (<font face="Courier">HDC</font>), or can be a string in the
format "<font face="Courier">hdc width height</font>" or, in C, "<font face="Courier">%p %d %d</font>".
To get the entire screen use a NULL data.<br>
<strong>X-Windows</strong>: It is a string in the format "<font face="Courier">display window</font>" or, in C, "<font face="Courier"><tt>%p
%lu</tt></font>" (uses the default screen).</p>
<p>The given parameters must exists until <font face="Courier"><strong>cdKillCanvas</strong></font> is called. The
<font face="Courier">HDC</font> is released only if created inside <font face="Courier"><strong>cdCreateCanvas</strong></font>
from an <font face="Courier">HWND</font> or when data is NULL.</p>
<p>Any amount of such canvases may exist simultaneously, but they should not use the same window, except if you are
using a GDI canvas and a GDI+ canvas at the same time for the same window.</p>
<p>In CDLUA, the creation parameter must be a string in X-Windows and a userdata in Microsoft Windows.</p>
<p>To use this driver in Windows using GDI+ is necessary to call
<font face="Courier"><strong>
cdUseContextPlus</strong></font><strong><font face="Courier">(1)</font></strong>
before creating the canvas.</p>
<h3>Exclusive Functions</h3>
<h4><font face="Courier">void cdGetScreenSize(int *width, int *height, double *width_mm, double *height_mm); [in C]<br>
<font face="Courier New" color="#808080">cd.Get</font></font><font color="#808080"><font face="Courier New">Screen</font><font face="Courier"><font face="Courier New">Size()
-> (width, heigth, mm_width, mm_height:</font> <i>number</i><font face="Courier New">)</font> [in Lua]</font></font></h4>
<p>Equivalent to function <a href="../func/coordinates.html#cdGetCanvasSize">
<font face="Courier"><b>cdCanvasGetSize</b></font></a>, but returns the values relative to the main screen of the
window system. It is not necessary to have an active canvas to call this function.</p>
<h4><font face="Courier">int cdGetScreenColorPlanes(void); [in C]<br>
<font color="#808080">cd.GetScreenColorPlanes() -> (bpp: <em>number</em>) [in Lua</font>]</font></h4>
<p>Equivalent to function <a href="../func/color.html#cdGetColorPlanes">
<font face="Courier"><b>cdCanvasGetColorPlanes</b></font></a>, but returns the value relative to the main screen of the
window system. It is not necessary to have an active canvas to call this function.</p>
<h3>Behavior of Functions</h3>
<p>This driver is greatly platform-dependent. For further detail, see the <b>Behavior of Functions</b> in each
platform: <a href="win32.html">Microsoft Windows (GDI)</a>, <a href="gdiplus.html">Windows Using GDI+</a>,
<a href="xwin.html">X-Windows (XLIB)</a>. However, it should be noted that some functions behave differently from the
basic functions of each platform.</p>
<h4>Control</h4>
<ul>
<li><a href="../func/init.html#cdActivate"><font face="Courier"><strong>
cdCanvasActivate</strong></font></a>: updates the canvas size; the window might have been resized. If the canvas was created
using a HDC, the size will not be updated. <br>
<br>
<span style="color: #FF0000"><strong>IMPORTANT</strong></span>:
For the standard Win32 base driver (not GDI+) if your Windows does not have one of the styles CS_OWNDC or CS_CLASSDC,
then a temporary HDC will be created everytime a <strong>cdCanvasActivate</strong> is called. To release this HDC call
<strong>cdCanvasDeactivate</strong> after
drawing. The IupCanvas control of the IUP library in the Win32 driver have the style, so
this should be ignored. But the IupCanvas in the GTK driver running in Win32
does not have this style so
<strong>cdCanvasDeactivate</strong> should be used.</li>
</ul>
<h4>Exclusive Attributes</h4>
<ul>
<li>"<b><font face="Courier">WINDOWRGN</font></b>": set the shape of a window to the current complex clipping region
(set only). If data is NULL the region is reset.</li>
</ul>
</body>
</html>
|