💾 Archived View for blitter.com › apl-books › APLX50 › APLX-manual › www.microapl.com › apl_help › c… captured on 2023-01-29 at 14:37:41.

View Raw

More Information

⬅️ Previous capture (2022-07-17)

-=-=-=-=-=-=-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Using the Draw method</TITLE>
<META NAME="DESCRIPTION" CONTENT="APL language help page: Using the Draw method">
<META NAME="KEYWORDS" CONTENT="Draw,graphics,apl,aplx,apl help">
<!-- %%COMMON_HEAD%% -->
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="http://www.microapl.com/styles_apl_help.css">
<!-- %%END%%-->
</HEAD>
<body>
<table>
<tr>
<td width="800" valign="top" colspan="2">
<center>Topic: <A HREF="ch.htm"><code>APLX Help</code></A>
: <A HREF="ch_030.htm"><code>System Classes</code></A>
: <A HREF="ch_030_070.htm"><code>Using the Draw method</code></A>
</center>
<center>
[ <A HREF="ch_030_070_010.htm">Next</A> | <A HREF="ch.htm">Contents</A> | <A HREF="help_index.htm">Index</A>  | <A HREF="http://www.microapl.co.uk/apl/index.html">APL Home</A> ]</center>
<br></td>
</tr>
<tr>
<td width="120">
<a href="http://www.microapl.co.uk/apl/index.html"><img height="68" border="0" width="119" src="MicroAPL_logo.gif" alt="www.microapl.co.uk"></a>
</td>
<td align="left" valign="bottom">
<h1>Using the Draw method</h1>
</td>
</tr>
<tr>
<td width="800" valign="top" colspan="2">
<hr>
<p>The <tt>Draw</tt> method allows you to draw text, lines, patterns, pictures and geometric shapes on windows, controls, and printer pages. It takes an argument which comprises one or more phrases which each start with a keyword indicating the operation to perform, followed by the arguments to that operation. (see the workspace <tt>10 HELPDRAW</tt> for examples).</p>

<p>Drawing takes place using a current Pen (for foreground drawing) and Brush (for background drawing). You can also set the Mode which determines how drawing interacts with what is already on the screen.</p>

<p>Coordinates are interpreted according to the current <i>Draw-method Scale</i> for the object.  The first time that the <tt>Draw</tt> method is used on a control, this is set to be the same as the <tt><A HREF="ch_030_030_0630.htm">scale</A></tt> property of the control. However, you can change it to be either one of the standard fixed scales, or to be proportional to the window size.</p>

<p>APLX automatically handles window refreshing for you if the window is uncovered or resized (you can switch this off using the <tt>autoredraw</tt> property).  It does this by storing the sequence of <tt>Draw</tt> commands applicable to the window or control, and replaying them when an update is required.  You can also group a series of commands together, and selectively enable or disable them (for example, to temporarily hide the labels on a graph), or delete them altogether from the saved sequence.  This is useful for animation effects.</p>

<p>The general syntax of the <tt>Draw</tt> method is:</p>
<pre>      Control.Draw '&lt;Keyword&gt;' Arg1 Arg2...
</pre>
<p>where <i>Control</i> is usually the a reference to the Window into which you want to draw, or a Printer, or a Frame, Picture or Image object, identified using dot notation (for example, <code>Win.Pic.Image1</code>).  You can also supply multiple sequences of commands on one line:</p>

<pre>      Control.Draw ('&lt;Keyword1&gt;' Arg1)  ('&lt;Keyword2&gt;' Arg1 Arg2)...
</pre>

<p>Alternatively, you can use the equivalent <code>&#9109;WI</code> syntax:</p>

<pre>      ControlName &#9109;WI 'Draw' '&lt;Keyword&gt;' Arg1 Arg2...
      ControlName &#9109;WI 'Draw' ('&lt;Keyword1&gt;' Arg1)  ('&lt;Keyword2&gt;' Arg1 Arg2)...
</pre>
<p>where <tt>ControlName</tt> is a character vector containing the name of the window or control (including parent if applicable), for example: <code>'Win'</code>  or <code>'Win.Pic.Image1'</code></p>

<p>The keywords are not case-sensitive, but it is recommended that you enter them in the case shown in the following sections.</p>
<p>The operations you can carry out using the <tt>Draw</tt> method fall into four categories:</p>

<p>
	<UL>
	<LI>Operations which <A HREF="ch_030_070_010.htm">set the state</A> of the drawing sub-system for the current control, defining how subsequent drawing commands will work.  These include commands to set the Pen, Brush, Font and Scale.
	<LI>Operations which <A HREF="ch_030_070_020.htm">cause drawing to take place</A> on the current control.  These include commands to draw lines, rectangles, arcs, and polygons, and to draw text (and find out what size rendered text would require on the screen).  You can also draw bitmaps and other images, either from file or directly as an array of color values held in an APL variable.
	<LI>Operations which <A HREF="ch_030_070_030.htm">determine how drawing commands are replayed</A> when a window update is required.  These include commands to group graphic elements together, to enable and disable specific groups, and to delete commands from the saved list. You can also obtain a bitmap or Scalable Vector Graphics (SVG) representation of the drawing, or copy it to the Clipboard.
	</UL>
</p>

<p>In the descriptions which follow, optional parameters are shown in square brackets.</p>

<hr>
</td>
</tr>
<tr>
<td width="800" valign="top" colspan="2">
<center>Topic: <A HREF="ch.htm"><code>APLX Help</code></A>
: <A HREF="ch_030.htm"><code>System Classes</code></A>
: <A HREF="ch_030_070.htm"><code>Using the Draw method</code></A>
</center>
<center>
[ <A HREF="ch_030_070_010.htm">Next</A> | <A HREF="ch.htm">Contents</A> | <A HREF="help_index.htm">Index</A>  | <A HREF="http://www.microapl.co.uk/apl/index.html">APL Home</A> ]</center>
<br></td>
</tr>
</table>
<!-- %%COMMON_BODY_TAIL%% -->
<p class="copyright">Copyright &copy; 1996-2010 MicroAPL Ltd</p>
<!-- %%END%% -->
</body>
</html>