summaryrefslogtreecommitdiff
path: root/html/en/func/init.html
diff options
context:
space:
mode:
Diffstat (limited to 'html/en/func/init.html')
-rw-r--r--html/en/func/init.html225
1 files changed, 225 insertions, 0 deletions
diff --git a/html/en/func/init.html b/html/en/func/init.html
new file mode 100644
index 0000000..c6e08b3
--- /dev/null
+++ b/html/en/func/init.html
@@ -0,0 +1,225 @@
+<!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=iso-8859-1">
+<title>Canvas Initialization</title>
+<link rel="stylesheet" type="text/css" href="../../style.css">
+</head>
+
+<body>
+
+<h2 align="center">Canvas Initialization</h2>
+<pre class="function"><span class="mainFunction">cdCanvas *<a name="cdCreateCanvas">cdCreateCanvas(cdContext* ctx, void *data)</a>; [in C]</span>
+
+cd.CreateCanvas(ctx: number, data: string or userdata) -&gt; (canvas: cdCanvas) [in Lua]</pre>
+
+ <p>Creates a CD canvas for a virtual visualization surface (VVS). A VVS may be the canvas of a user-interface window,
+ the page of a document sent to a printer, an offscreen image, the clipboard, a metafile, and so on. To create the
+ canvas, it is necessary to specify the driver in which each canvas is implemented. </p>
+ <p>The driver is set by the <b>driver</b> variable with additional information provided in the <tt>
+ <b>data</b></tt>
+ parameter. Even though it is possible to create more than one canvas with the same <tt>
+ <b>driver/data</b></tt> pair,
+ this is not recommended, and its behavior is not specified. Each canvas maintains its own features. </p>
+ <p>In case of failure, a&nbsp; <b>NULL</b> value is returned. The following predefined drivers are available:</p>
+
+
+ <p><b>Window-Base Drivers</b></p>
+
+
+ <ul>
+ <li><a href="../drv/iup.html"><b>CD_IUP</b></a> = IUP Canvas (<b>cdiup.h</b>).</li>
+ <li><a href="../drv/native.html"><b>CD_NATIVEWINDOW</b></a> = Native
+ Window (<b>cdnative.h</b>).</li>
+ </ul>
+
+
+ <p><b>Device-Based Drivers</b></p>
+
+
+ <ul>
+ <li><a href="../drv/clipbd.html"><b>CD_CLIPBOARD</b></a> = Clipboard (<b>cdclipbd.h</b>).</li>
+ <li><a href="../drv/printer.html"><b>CD_PRINTER</b></a> = Printer (<b>cdprint.h</b>).</li>
+ </ul>
+ <p><b>Image-Based Drivers</b>&nbsp; </p>
+ <ul>
+ <li><a href="../drv/image.html"><b>CD_IMAGE</b></a> = Server-Image
+ Drawing (<b>cdimage.h</b>).</li>
+ <li><a href="../drv/irgb.html"><b>CD_IMAGERGB</b></a> = Client-Image
+ Drawing (<b>cdirgb.h</b>).</li>
+ <li><a href="../drv/dbuf.html"><b>CD_DBUFFER</b></a> = Offscreen Drawing
+ (<b>cddbuf.h</b>).</li>
+ </ul>
+ <p><b>File-Based Drivers</b>&nbsp; </p>
+ <ul>
+ <li><a href="../drv/cgm.html"><b>CD_CGM</b></a> = Computer Graphics
+ Metafile ISO (<b>cdcgm.h</b>).</li>
+ <li><a href="../drv/dgn.html"><b>CD_DGN</b></a> = MicroStation Design
+ File (<b>cddgn.h</b>).</li>
+ <li><a href="../drv/dxf.html"><b>CD_DXF</b></a> = AutoCad Drawing
+ Interchange File (<b>cddxf.h</b>).</li>
+ <li><a href="../drv/emf.html"><b>CD_EMF</b></a> = Microsoft Windows
+ Enhanced Metafile (<b>cdemf.h</b>). Works only in MS Windows systems.</li>
+ <li><a href="../drv/mf.html"><b>CD_METAFILE</b></a> = Metafile Canvas
+ Draw (<b>cdmf.h</b>).</li>
+ <li><a href="../drv/ps.html"><b>CD_PS</b></a> = PostScript File (<b>cdps.h</b>).</li>
+ <li><a href="../drv/wmf.html"><b>CD_WMF</b></a> = Microsoft Windows
+ Metafile (<b>cdwmf.h</b>).</li>
+ </ul>
+
+<pre class="function"><span class="mainFunction">cdCanvas*&nbsp;<a name="cdCreateCanvasf">cdCreateCanvasf(cdContext *ctx, const char* format, ...)</a>; [in C]
+</span><font>
+</font>[There is no equivalent in Lua]</pre>
+
+ <p>Same as <strong><font>cdCreateCanvas</font></strong>, used in the case that the parameter <b>
+ <font>data</font></b> is a string composed by several parameters. This function can be used with
+ parameters equivalent to the <b><font>printf</font></b> function from the default C library.</p>
+
+<pre class="function"><span class="mainFunction">void&nbsp;<a name="cdKillCanvas">cdKillCanvas(cdCanvas *canvas)</a>; [in C]</span>
+
+cd.KillCanvas(canvas: cdCanvas) [in Lua]</pre>
+
+ <p>Destroys a previously created canvas. If this function is not called in
+ Lua, the garbage collector will call it.</p>
+
+<pre class="function"><span class="mainFunction">int&nbsp;<a name="cdCanvasActivate">cdCanvasActivate</a>(cdCanvas *canvas); [in C]</span>
+
+canvas:Activate(canvas: cdCanvas) -&gt; (status: number) [in Lua]</pre>
+
+ <p>Activates a canvas for drawing. This is used only for a few drivers. Native
+ Window and IUP drivers will update the canvas size if the window size has
+ changed. Double Buffer driver will recreate the image buffer if the window
+ canvas size has changed. In these cases the function MUST be called, for other
+ drivers is useless. Returns CD_ERROR or CD_OK.</p>
+
+<pre class="function"><span class="mainFunction">void&nbsp;<a name="cdCanvasDeactivate">cdCanvasDeactivate</a>(cdCanvas* canvas); [in C]</span>
+
+canvas:Deactivate(canvas: cdCanvas) [in Lua]</pre>
+
+ <p>Called when the application has finished drawing in the canvas. It is
+ optional, but if used for the Native Window driver in Windows when the handle
+ can not be retained, the drawing can only be done again after a <strong>
+ cdCanvasActivate</strong>. On some drivers will simply call
+ <a href="control.html#cdFlush">Flush</a>.</p>
+<pre class="function"><span class="mainFunction">int <a name="cdUseContextPlus">cdUseContextPlus</a>(int use); [in C]</span>
+
+cd.UseContextPlus(use: number) -&gt; (old_use: number) [in Lua]</pre>
+<p>Activates or deactivates the use of an external context for the next calls of the <font face="Courier"><b>
+ <a href="../func/init.html#cdCreateCanvas">cdCreateCanvas</a></b></font>
+ function.</p>
+
+<pre class="function"><span class="mainFunction">void <a name="cdInitContextPlus">cdInitContextPlus</a>(void); [in C]
+</span>
+cd.InitContextPlus() [in Lua]</pre>
+<p>Initializes the context driver to use another context replacing the standard drivers.
+This functions is only available when a library containing a &quot;ContextPlus&quot;
+context driver is used. See the <a href="../drv/gdiplus.html">GDI+</a> base
+driver and the <a href="../drv/xrender.html">XRender</a> base driver.</p>
+<p>In Lua, when using require&quot;cdluacontextplus&quot; this function will be
+automatically called.</p>
+
+<hr>
+<pre class="function"><span class="mainFunction">cdContext*&nbsp;cdCanvasGetContext(cdCanvas *canvas); [in C]</span>
+
+canvas:GetContext(canvas: cdCanvas) -&gt; (ctx: number) [in Lua]</pre>
+
+ <p>Returns the context of a given canvas, which can be compared with the predefined contexts, such as &quot;CD_PS&quot;.</p>
+
+<pre class="function"><span class="mainFunction">int&nbsp;cdContextCaps(cdContext* ctx); [in C]</span>
+
+cd.ContextCaps(ctx: number) -&gt; (caps: number) [in Lua]</pre>
+
+ <p>Returns the resources available for that context. To verify if a given resource is available, perform a binary AND
+ ('&amp;.html with the following values:</p>
+
+ <p><font>CD_CAP_FLUSH<br>
+ CD_CAP_CLEAR <br>
+ CD_CAP_PLAY <br>
+ CD_CAP_YAXIS</font> - The Y axis has the same orientation as the CD axis.<br>
+ <font>CD_CAP_CLIPAREA <br>
+ CD_CAP_CLIPPOLY</font> - Usually is not implemented.<br>
+ <font>CD_CAP_MARK</font> - Marks are implemented directly in the driver (they are usually simulated).<br>
+ <font>CD_CAP_RECT</font> - Rectangles are implemented directly in the driver (they are usually
+ simulated).<br>
+ <font>CD_CAP_VECTORTEXT</font> - Vector text is implemented directly in the driver (it is usually
+ simulated).<br>
+ <font>CD_CAP_IMAGERGB <br>
+ CD_CAP_IMAGERGBA</font> - If this is not implemented, but <font>cdGetImageRGB</font> is, then it is
+ simulated using <font>cdGetImageRGB</font> and <font>cdPutImageRGB</font>.<br>
+ <font>CD_CAP_IMAGEMAP <br>
+ CD_CAP_GETIMAGERGB <br>
+ CD_CAP_IMAGESRV</font> - Usually is only implemented in contexts of window graphics systems (Native Window and IUP).<br>
+ <font>CD_CAP_BACKGROUND <br>
+ CD_CAP_BACKOPACITY <br>
+ CD_CAP_WRITEMODE <br>
+ CD_CAP_LINESTYLE <br>
+ CD_CAP_LINEWITH <br>
+ CD_CAP_WD</font> - Functions of world coordinates are implemented directly in the driver (they are usually
+ simulated).<br>
+ <font>CD_CAP_HATCH <br>
+ CD_CAP_STIPPLE <br>
+ CD_CAP_PATTERN <br>
+ CD_CAP_FONT <br>
+ CD_CAP_FONTDIM</font> - If not defined, the function is implemented using an internal heuristics of the library.<br>
+ <font>CD_CAP_TEXTSIZE</font> - If not defined, the function is implemented using an internal
+ heuristics of the library.<br>
+ <font>CD_CAP_TEXTORIENTATION</font> - Usually is not implemented.<br>
+ <font>CD_CAP_PALETTE</font> - Usually is only implemented in contexts of window graphics systems
+ (Native Window and IUP).</p>
+
+
+<pre class="function"><span class="mainFunction">int&nbsp;cdCanvasSimulate(cdCanvas* canvas, int mode); [in C]</span>
+
+canvas:Simulate(mode: number) -&gt; (old_mode: number) [in Lua]</pre>
+
+ <p>Activates the simulation of one or more primitives. It is ignored for the canvas
+ in the ImageRGB context, because in this case everything is already simulated. It also has no effect for primitives that
+ are usually simulated. It returns the previous simulation, but does not include primitives that are usually simulated.
+ The simulation can be activated at any moment. For instance, if a line simulation is required only for a situation,
+ the simulation can be activated for the line to be drawn, and then deactivated.</p>
+<p>If simulation is activated the driver transformation matrix is disabled.</p>
+ <p>See in the Simulation sub-driver the information on how each simulation is performed.</p>
+ <p>To activate a given simulation, perform a binary OR ('|.html using one or more of the following values (in Lua, the
+ values must be added '+.html:</p>
+ <p><font>CD_SIM_NONE</font> - Deactivates all kinds of simulation.<br>
+ <font>CD_SIM_LINE <br>
+ CD_SIM_RECT <br>
+ CD_SIM_BOX <br>
+ CD_SIM_ARC <br>
+ CD_SIM_SECTOR <br>
+ CD_SIM_CHORD <br>
+ CD_SIM_POLYLINE <br>
+ CD_SIM_POLYGON <br>
+ CD_SIM_TEXT <br>
+ CD_SIM_ALL</font> - Activates all simulation options. <br>
+ <font>CD_SIM_LINES</font> - Combination of <font>CD_SIM_LINE, CD_SIM_RECT, CD_SIM_ARC</font>
+ and <font>CD_SIM_POLYLINE</font>.<br>
+ <font>CD_SIM_FILLS</font> - Combination of <font>CD_SIM_BOX, CD_SIM_SECTOR, CD_SIM_</font>CHORD and
+ <font>CD_SIM_POLYGON</font>.<br>
+ </p>
+
+<h3>Extras</h3>
+<pre class="function">int <strong><span style="font-size: 110%"><a name="cdlua_open">cdlua_open</a></span></strong>(lua_State* L); [for Lua 5]</pre>
+
+ <p>Initializes the CDLua binding. In Lua 5 the binding is lua state safe, this means that several states can be
+ initialized any time.</p>
+
+<pre class="function">int <strong><span style="font-size: 110%"><a name="cdlua_close">cdlua_close</a></span></strong>(lua_State* L); [for Lua 5]</pre>
+
+ <p>Releases the memory allocated by the CDLua binding.</p>
+
+<pre class="function">cdCanvas* <strong><span style="font-size: 110%"><a name="cdlua_getcanvas">cdlua_checkcanvas</a></span></strong>(lua_State* L, int pos); [for Lua 5]</pre>
+
+ <p>Returns the canvas in the Lua stack at position pos. The function will call lua_error if there is not a valid canvas in
+ the stack at the given position.</p>
+
+
+<pre class="function">void <strong><span style="font-size: 110%">cdlua_pushcanvas</span></strong>(lua_State* L, cdCanvas* canvas);</pre>
+<p>Pushes the given canvas into the stack.</p>
+
+
+</body>
+
+</html> \ No newline at end of file