Javascript required
Skip to content Skip to sidebar Skip to footer

Drawing a Circle With Matrix Vectors

www.microapl.co.uk

Depict method: Rendering commands


Articulate

Syntax: Control.Draw 'Clear'

Erases the unabridged drawing area and fills information technology with the current Castor. (For a Printer object, it ejects the page instead). Notation that this command does not delete saved commands associated with the command, so for efficiency and to avoid wasting memory you should not telephone call this method repeatedly if the autoredraw property is ane. Alternatively you lot should use the Reset keyword to delete saved commands before calling Clear.

Bitmap (from file)

Syntax: Control.Draw 'Bitmap' Filename [[[Row Col] Height Width] Stretch]

Alternative keywords: 'Picture' or 'Icon'

Draws an image from a file on the command. The Filename parameter is the path to the file containing the image. Under Windows, this tin be a Bitmap (.bmp), Windows metafile (.wmf), Icon (.ico) or JPEG (.jpg or .jpeg) image. Under MacOS, the supported formats include bitmaps and JPEGs, likewise every bit MacOS PICT files and usually other formats such as TIFF and GIF. Nether Linux, the supported types depend on the operating organization version simply will typically include .png .xpm .jpg .jpeg .ico and .bmp files. (To display all formats, your Windows or MacOS system may need an appropriate graphics converter or QuickTime module installed). APLX automatically caches the picture in memory, and releases information technology when it is no longer needed. If you display multiple copies of the same moving-picture show, only one re-create will be loaded in retention.

The optional Row and Col parameters determine the tiptop left corner on the control where the film will be displayed.

Ordinarily the motion-picture show is displayed at its natural size. The optional Summit and Width parameters allow you to specify the size of the rectangle in which it is displayed. If the Stretch parameter is 0 or omitted, the picture is clipped to this size. If information technology is i, the flick is stretched or shrunk to fit the specified height and width. (However, for Icons this parameter must exist 0).

You tin can also draw multiple bitmaps with a single command by passing a nested vector of multiple Filename...Stretch parameters.

Bitmap (from APL variable)

Syntax: Control.Describe 'Bitmap' Assortment [[[Row Col] Height Width] Stretch]

Alternative keywords: 'Picture' or 'Icon'

This second form of the Bitmap command allows yous to pass an APL array which contains the picture equally a set up of RGB colour values. The Array parameter is a two-dimensional integer array. Each chemical element contains a color value for the corresponding pixel. The color value is encoded equally 256⊥Blue Dark-green Red where each color value is in the range 0 to 255.

The other parameters are as described above.

You can besides draw multiple bitmaps with a unmarried command past passing a nested vector of multiple Array...Stretch parameters.

Circle

Syntax: Control.Describe 'Circle' Row Col Radius [[[[Attribute] StartAngle EndAngle] Border] TiltAngle]

Draws a circle, ellipse, arc, or pie slice. The figure is drawn with the electric current Pen and filled with the current Brush.

The Row and Col parameters make up one's mind the center of the circle or ellipse. The Radius parameter determines the radius of the circle or ellipse. If the Aspect parameter is 1 (default), the figure drawn will exist a circle provided the current scale has the same units along both axes. If the Attribute parameter is greater than 0, the Radius parameter determines the radius along the horizontal axis, and the radius forth the vertical axis is obtained by multiplying Radius by Aspect. If Aspect is less than 0, the Radius parameter determines the radius along the vertical axis and the radius along the horizontal axis is obtained by multiplying Radius by the absolute value of Aspect.

The optional StartAngle and EndAngle parameters are used for pie slices and arcs. They are measured in degrees, anti-clockwise from the right horizontal centrality. The default is 0 360, i.e. a full circle or ellipse.

The Edge parameter determines which lines are drawn with the Pen. It is the sum of:

1  Draw the circumference  two  Draw the radius at the starting angle 4  Draw the radius at the finish angle

The default is 1. If you don't want any line to be drawn, you can set Border to 0 or utilize a transparent Pen. If you don't want the figure to exist filled, use a transparent Brush.

The final optional parameter, TiltAngle, allows yous to specify that you want the figure rotated from the horizontal. It is expressed in degrees counter-clockwise from the right horizontal axis. The rotation is applied after all of the other parameters accept been evaluated, then the radius along what would have been the horizontal centrality becomes the radius along the line at TiltAngle degrees from the horizontal. (If you specify this parameter, drawing may be slower and the figure less precise than it would be if you omit it).

You can also draw multiple figures either past passing multiple enclosed vectors of 3 to 8 parameters, or by passing a matrix of 3 to viii columns.

Chord

Syntax: Control.Draw 'Chord' Row Col Radius [[[[Aspect] StartAngle EndAngle] Border] TiltAngle]

Draws a chord (ie the intersection of a circle and a line). The figure is drawn with the current Pen and filled with the current Brush.

The parameters are the aforementioned as for Circle, except for the Border parameter, which is the sum of:

1  Depict the circumference  2  Describe the intersecting line

You can too depict multiple chords either past passing multiple enclosed vectors of three to eight parameters, or by passing a matrix of 3 to 8 columns.

Ellipse

Syntax: Control.Describe 'Ellipse' Row Col Pinnacle Width

Draws a circle or ellipse. The effigy is drawn with the current Pen and filled with the current Castor.

This is similar to the Circle command, but only consummate circles/ellipses can be fatigued and the size of the effigy is expressed in a different way. The Row and Col parameters make up one's mind the top, left of the rectangle which just contains the figure. The Height and Width parameters determine the size of the containing rectangle.

Yous can describe multiple figures past passing a nested vector of four-element parameters, or by passing an N by four matrix.

Line

Syntax: Control.Draw 'Line' Points

Draws one or more continued lines using the current Pen.

The Points parameter is an N by 2 numeric matrix describing the points to be connected, where N is at least 2. The first column represents the Rows, and the second cavalcade the Columns.

You can as well depict multiple series of lines in one control by passing multiple sets of Points arrays.

Seg

Syntax: Control.Depict 'Seg' Array [Assortment, Array...]

Draws one or more sets of connected lines (without polygon fill) in one operation, using the current Pen.

The argument comprises ane or more Thousand by N matrices of: Y1 X1 Y2 X2... Each row of the matrix corresponds to one prepare of connected lines. Points are taken in pairs from each row, so Northward must be fifty-fifty, and the sets of lines in each array must have the same number of segments.

This method is provided mainly for compatibility with APL+Win. You can achieve the same event in a more flexible style past supplying a nested argument to the Line keyword.

Poly

Syntax: Command.Describe 'Poly' Points

Draws a polygon using the current Pen, and fills the polygons using the current Brush.

The Points parameter is an North past 2 numeric matrix describing the points to be connected, where N is at least 3. The start column represents the Rows, and the second column the Columns. APLX automatically draws the final line to connect the last point to the first. For complex shapes, the Mode command specifies the algorithm used to make up one's mind which regions of the polygon are filled.

If you don't want the polygon to be filled, apply a transparent brush.

You tin can also depict multiple polygons in one command by passing multiple sets of Points arrays.

Rect

Syntax: Control.Draw 'Rect' Row Col Height Width [RoundingV RoundingH]

Draws a rectangle or round-cornered rectangle. The rectangle is fatigued with the electric current Pen and filled with the current Brush.

The Row and Col parameters decide the top, left of the rectangle, and the Height and Width parameters decide its size. For a circular-cornered rectangle, the RoundingV and RoundingH parameters determine the diameter of the corners in the vertical and horizontal directions respectively.

You tin also draw multiple rectangles in one control by passing a nested vector of 4- or vi-chemical element parameters, or past passing an N by 4 or 6 matrix.

Text

Syntax: Control.Depict 'Text' String Row Col

Draws a text string in the current Font.

The String parameter is a character vector or matrix containing the text to exist written. It can incorporate embedded railroad vehicle render (⎕R) characters. If information technology is a matrix, wagon returns are automatically inserted at the end of each line. The Row and Col parameters decide the starting position. Text can be written at an bending by setting the angle using the Font command.

TextSize

Syntax: R ← Command.Draw 'TextSize' String [Cord, String..]

Alternative keyword: '?Text'

Determines the size required to render one or more text strings in the electric current Font.

The argument comprises one or more character scalars, vectors or matrices. If only one string is supplied, the result is a 2-element numeric vector containing the height and width required to depict the cord with the currently-selected font, in the current Draw calibration. If more than one string is supplied, the result is a nested vector with 1 element per string. Each element is a two-element vector giving the pinnacle and width required for the corresponding string.


fredericminch1949.blogspot.com

Source: https://microapl.com/apl_help/ch_030_070_020.htm