summaryrefslogtreecommitdiff
path: root/html/en/cdluaim.html
blob: 707539d124b7bcadf66160e4bd717c4eba52a5ae (plain)
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
<!doctype HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  <head>
    <title>CDLua+IMLua</title>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="../style.css">
  </head>
  <body>
    <h2 align="center">CDLua+IMLua</h2>

<p>
When CD is used togheter with the IM library in Lua, the CD bitmap and the IM 
image objects in Lua have a few more methods. These methods allow to map the <font face="Courier New">imImage</font> 
  structure to the <font face="Courier New">cdBitmap</font> structure and add some facilities to draw 
on an imImage using a CD 
  canvas. See also the <a target="_blank" href="http://www.tecgraf.puc-rio.br/im">IM documentation</a>.<p>Color values and palettes can be created and used transparently in both libraries. Palettes and color values are 
  100% compatible between CD and IM.</p>


	<p>
 You must link the application with the "cdluaim51" library.<p>
See also the <a target="_top" href="http://www.tecgraf.puc-rio.br/im">IM 
documentation</a>.<pre class="function">int <strong><span style="font-size: 110%"><a name="cdlua_open">cdluaim_open</a></span></strong>(lua_State* L); [in C] [for Lua 5]</pre>

  	<p>
Must be called to enable the additional methods. Can be called only after CDLua 
and IMLua were initialized. require&quot;cdluaim&quot; can also be used. <br>
 Returns 0 (leaves nothing on the top of the stack).<hr>
	<h3>Available methods</h3>
	<pre class="function">bitmap:imImageCreate() -&gt; image: imImage [in Lua] 
</pre>
<p>Creates an imImage from a cdBitmap.</p>
<pre class="function">image:cdCreateBitmap() -&gt; bitmap: cdBitmap [in Lua]</pre>
<p>Creates a cdBitmap from an imImage. The imImage must be a bitmap image, see 
&quot;image:<strong>IsBitmap</strong>&quot;. </p>
<pre class="function">image:cdInitBitmap() -&gt; bitmap: cdBitmap [in Lua]</pre>
<p>Creates a cdBitmap from an imImage, but reuses image data. When the 
cdBitmap is destroyed, the data is preserved. </p>
<pre class="function">image:cdCanvasPutImageRect(canvas: cdCanvas, x: number, y: number, w: number, h: number, xmin: number, xmax: number, ymin: number, ymax: number) [in Lua] </pre>
<p>&nbsp;&nbsp;&nbsp; Draws the imImage into the given cdCanvas. The imImage must be a 
bitmap image, see \ref imImageIsBitmap. </p>
<pre class="function">image:wdCanvasPutImageRect(canvas: cdCanvas, x: number, y: number, w: number, h: number, xmin: number, xmax: number, ymin: number, ymax: number) [in Lua]     </pre>
<p>Draws the imImage into the given cdCanvas using world coordinates. The 
imImage must be a bitmap image, see \ref imImageIsBitmap. </p>
<pre class="function">image:cdCanvasGetImage(canvas: cdCanvas, x: number, y: number) [in Lua]     </pre>
<p>Retrieve the imImage data from the given cdCanvas. The imImage must be a 
IM_RGB/IM_BYTE image. </p>
<pre class="function">image:cdCreateCanvas([res: number]) -&gt; canvas: cdCanvas [in Lua]    </pre>
	<p>&nbsp;Creates a cdCanvas using the <a href="drv/irgb.html">CD_IMAGERGB</a> driver. Resolution is optional, 
	default is 3.8 pixels per milimiter (96.52 DPI). The imImage must be a 
	IM_RGB/IM_BYTE image. </p>
</BODY>
</HTML>