Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 10 of 18

Qlarity-Based Terminal Programmer's Reference Manual: Chapter 4 Qlarity API Function Reference, pages 56 to 64

Pages 56 to 64 of 134, from Qlarity-Based Terminal Programmer's Reference Manual

The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the QSI Corp QTERM-G70

Page 56

44

4.4.4

QSI Qlarity-based Terminal Programmer’s Reference

Raise

Parameters: {obj} A reference to the object to resize.

Syntax: raise(obj as objref)

{width} The new width of the object.

Parameters: {obj} A reference to the object to be moved in Z-order.

{height} The new height of the object.

Description: This function moves the object in front of the sibling object directly in front of it. If the object is the only child of its parent, or is already at the front, this function has no effect.

Description:

lower(obj as objref)

This function resizes an object to the specified height and width by altering the system software object attributes for the specified object. The display regions for both the old and new area of the object are invalidated, and a MSG_DRAW message is generated. If you specify -1 for either parameter, the dimension for that parameter remains unchanged.

Parameters:

4.5.3

{obj} A reference to the object to be moved in Z-order.

Syntax:

4.4.5

Lower

Syntax:

Description:

Relocate relocate(obj as objref, x as integer, y -> as integer)

This function moves the object behind the sibling object directly behind it. If the object is the only child of its parent, or is already at the back, this function has no effect.

Parameters:

4.5 Redrawing Portions of the Display

{x} The new x-position (horizontal coordinate) in pixels for the object (relative to the calling object's parent).

4.5.1

Rerender

Syntax: rerender(obj as objref)

{obj} A reference to the object to be relocated.

{y} The new y-position (vertical coordinate) in pixels for the object (relative to the calling object's parent).

Parameters: {obj} A reference to the object to be redrawn. Description: This function invalidates the display region for the area of the specified object causing a MSG_DRAW message to be generated.

Description: This function relocates an object to the specified position by altering the system software object attributes for the specified object. The display regions for both the old and new positions of the object are invalidated, and a MSG_DRAW message is generated.

4.6 Painting to the Display 4.5.2

Resize

Syntax: resize(obj as objref, width as integer, -> height as integer)

Functions that draw on the display must be placed inside a MSG_DRAW message handler. Attempting to call these functions outside a MSG_DRAW message handler will cause a runtime exception to occur.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 57

QSI Qlarity-based Terminal Programmer’s Reference

Many of these functions take a parameter of type “color,” which is an enumerated type representing the many colors that are available on the color display. See Appendix A for a complete list of available colors. Color values may also be obtained at runtime using the RGB() function (see section 4.6.5). For grayscale displays, the luminances of the selected colors are automatically converted to grayscale. This allows an application to run on either the color or grayscale display with little modification. (Since the grayscale conversion compresses multiple colors into each grayscale value, the transparency settings may cause some differences in how the application is displayed.) The default foreground color is RGB_WHITE, and the default background color is RGB_BLACK. 4.6.1

SetTransparent

SetFgColor

Syntax: setfgcolor(newcolor as byte)

Parameters: {newcolor} A byte specifying the foreground color. Description: This function sets the foreground color to “{newcolor}” for the current message handler or until this function is called again. The last color setting persists until the message handler returns. The foreground color is used by various drawing API functions. 4.6.4

SetBgColor

Syntax: setbgcolor(newcolor as byte)

Syntax: settransparent(newcolor as byte)

Parameters: {newcolor} A byte specifying the transparent color. Description: This function sets the transparent color to “{newcolor}” for the current message handler. This color setting persists until the message handler returns. The transparent color is not drawn on the display, allowing objects behind any transparent regions to remain visible. 4.6.2

4.6.3

45

UseTransparent

Syntax: usetransparent(flag as boolean)

Parameters: {newcolor} A byte specifying the background color. Description: This function sets the background color to “{newcolor}” for the current message handler or until this function is called again. The last color setting persists until the message handler returns. The background color is used by various drawing API functions. 4.6.5

RGB

Syntax: rgb(red as byte, green as byte, blue as -> byte)returns color

Parameters:

Parameters: {flag} A boolean value specifying whether transparency is enabled (true) or disabled (false). Description: This function enables or disables transparency for the duration of the current message handler or until it is called again. As transparency is disabled by default, this function must be called at least once in each message handler that uses the transparency feature.

{red} An 8-bit integer indicating the amount of red in the desired color. 255 is maximum, 0 is minimum. {green} An 8-bit integer indicating the amount of green in the desired color. 255 is maximum, 0 is minimum. {blue} An 8-bit integer indicating the amount of blue in the desired color. 255 is maximum, 0 is minimum.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 58

46

QSI Qlarity-based Terminal Programmer’s Reference

Description:

4.6.8

This function is used to obtain a color value at runtime from user-specified red, green, and blue values. The returned color value may be used anywhere a color value is required [e.g., SetFgColor()]. 4.6.6

SetPixel

Syntax: setpixel(x as integer, y as integer)

Parameters: {x} The x-position of the pixel to draw (relative to the calling object's parent). {y} The y-position of the pixel to draw (relative to the calling object's parent). Description: This function draws the pixel at the specified location using the foreground color. 4.6.7

DrawLine

Syntax: drawline(x1 as integer, y1 as integer, x2 -> as integer, y2 as integer)

Parameters: {x1} The x-position of the first endpoint of the line (relative to the calling object's parent). {y1} The y-position of the first endpoint of the line (relative to the calling object's parent). {x2} The x-position of the second endpoint of the line (relative to the calling object's parent). {y2} The y-position of the second endpoint of the line (relative to the calling object's parent). Description: This function draws a line, using the foreground color, between the two points defined by (x1, y1) and (x2, y2).

DrawBitmap

Syntax: drawbitmap(x as integer, y as integer, -> bmp as bitmap)

Parameters: {x} The desired x-position of the upper-left corner of the bitmap (relative to the calling object's parent). {y} The desired y-position of the upper-left corner of the bitmap (relative to the calling object's parent). {bmp} The bitmap resource to draw. Description: This function displays a bitmap at the coordinate given. The origin of the x and y values is at the top left corner of the parent container. 4.6.9

DrawBitmapRegion

Syntax: drawbitmapregion(x as integer, y as -> integer, xoffset as integer, yoffset as -> integer, width as integer, height as -> integer, bmp as bitmap)

Parameters: {x} The desired x-position of the upper-left corner of the bitmap (relative to the calling object's parent). {y} The desired y-position of the upper-left corner of the bitmap (relative to the calling object's parent). {xoffset} The x-position of the pixel in the bitmap to draw at “{x},{y}.” {yoffset} The y-position of the pixel in the bitmap to draw at “{x},{y}.” {width} Number of pixels per row to copy from the bitmap.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 59

QSI Qlarity-based Terminal Programmer’s Reference

{height} Number of pixels per column to copy from the bitmap. {bmp} The bitmap resource to draw. Description: This function prints a portion of a bitmap at the coordinate specified by “{x},{y}.” The displayed portion of the bitmap is specified by “{xoffset},” “{yoffset},” “{width},” and “{height}.” The location of the “{x}” and “{y}” values is relative to the top left corner of the parent container. 4.6.10 GetObjPixmap Syntax: getobjpixmap(width as reference to -> integer, height as reference to integer)-> returns color[]

Parameters: {width} Variable in which the width of object “pixmap” is to be stored.

47

Parameters: {x} The desired x-position of the upper-left corner of the pixel map (relative to the calling object's parent). {y} The desired y-position of the upper-left corner of the pixel map (relative to the calling object's parent). {pixmap} The pixel map array. {mapwidth} The width of the pixel map. {mapheight} The height of the pixel map. Description: This function draws a pixel map. The “{pixmap}” array must have a size of “{mapwidth} ∗ {mapheight}.” The entire pixel map is copied starting with the top left pixel of the pixel map copied to the location specified by “{x},{y}.” 4.6.12 DrawPixmapRegion

{height} Variable in which the height of object “pixmap” is to be stored. Description: This function is used to retrieve the pixel map for an object. The pixel map indicates the individual colors drawn in each pixel location for the object (based on the size of the object given to the Resize() function). The returned array is a color array of size “{width} ∗ {height},” indicating the colors drawn at each location in the object up to this point. Thus, the color drawn at pixel coordinate x,y in the object (with 0,0 being the top left pixel of the object) is the color indicated by the (({y} ∗ {width}) + {x}) element in the returned array.

Syntax: drawpixmapregion(x as integer, y as -> integer, xoffset as integer, yoffset as -> integer, width as integer, height as -> integer, pixmap[] as reference? to byte, -> mapwidth as integer, mapheight as integer)

Parameters: {x} The desired x-position of the upper-left corner of the pixel map (relative to the calling object's parent). {y} The desired y-position of the upper-left corner of the pixel map (relative to the calling object's parent).

4.6.11 DrawPixmap Syntax: drawpixmap(x as integer, y as integer, -> pixmap[] as reference? to byte, mapwidth -> as integer, mapheight as integer)

{xoffset} The x-position of the pixel in the pixel map to draw at “{x},{y}.” {yoffset} The y-position of the pixel in the pixel map to draw at “{x},{y}.”

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 60

48

QSI Qlarity-based Terminal Programmer’s Reference

{width} Number of pixels per row to copy from the pixel map.

4.6.14 DrawBox Syntax:

{height} Number of pixels per column to copy from the pixel map.

drawbox(left as integer, top as integer, -> right as integer, bottom as integer)

{pixmap} The pixel map array.

Parameters:

{mapwidth} The width of the pixel map. {mapheight} The height of the pixel map. Description: This function draws a section of a pixel map. The “{pixmap}” variable must have a size of “{mapwidth} ∗{mapheight}.” The coordinate “{xoffset},{yoffset}” indicates which pixel in the pixel map should map to the position “{x},{y}.” Starting at that point, a rectangular section of the pixel map is copied so that the total number of rows copied is “{height},” and the total number of columns copied is “{width}.” 4.6.13 GetBitmapSize Syntax: getbitmapsize(width as reference to -> integer, height as reference to integer, -> bmp as bitmap)

{left} The x-position for the left side of the box (relative to the calling object's parent). {top} The y-position for the top of the box (relative to the calling object's parent). {right} The x-position for the right side of the box (relative to the calling object's parent). {bottom} The y-position for the bottom of the box (relative to the calling object's parent). Description: This function draws a filled box at the position specified. The box has a one-pixel border drawn in the foreground color and is filled with the background color. 4.6.15 DrawPolygon Syntax: drawpolygon(xpoints[] as integer, -> ypoints[] as integer, flags as poly_flags)

Parameters: {width} An integer to receive the width of the bitmap resource.

Parameters:

{height} An integer to receive the height of the bitmap resource.

{xpoints} An array of integers containing the x-position for each point of the polygon (relative to the calling object's parent).

{bmp} The bitmap resource. Description: This function determines the size of a bitmap resource. “{width}” and “{height}” receive values, in pixels, corresponding to the width and height of the “{bmp}” bitmap resource.

{ypoints} An array of integers containing the y-position for each point of the polygon (relative to the calling object's parent). {flags} A value of type “poly_flags” (see below) that determines how the polygon will be drawn. Description: This function draws a polygon by connecting line segments between each of the points defined in the “{xpoints}” and

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 61

QSI Qlarity-based Terminal Programmer’s Reference

49

“{ypoints}” arrays. The “{flags}” parameter has type “poly_flags,” which is an enumerated type with the following legal values:

{yfocal} The vertical distance from the center to the primary focal point of the ellipse (relative to the calling object's parent).

POLY_NORMAL Draw the outline of the polygon in the foreground color. Do not fill the polygon.

{theta} The angle (in radians) from the primary focal point vector segment to the starting point of the arc. Positive angles increase counter-clockwise from the primary focal point vector segment.

POLY_FILL Draw the outline of the polygon in the foreground color and fill it with the background color. POLY_NOCONNECT Do not connect the ends of the polygon (it is a line - the POLY_FILL flag is ignored). The polygon may have intersecting regions, if desired.

{gamma} The angle (in radians) from the primary focal point vector segment to the ending point of the arc. Positive angles increase counter-clockwise from the primary focal point vector segment.

4.6.16 DrawEllipse

{flags} A value of type “ellipse_flags” (see below) that determines how the ellipse will be drawn.

Syntax:

Description:

drawellipse(xoffset as integer, yoffset -> as integer, a as float, {xfocal} as -> float, yfocal as float, theta as float, -> gamma as float, flags as ellipse_flags)

This complex but powerful function draws an open or closed elliptical arc centered at ({xoffset}, {yoffset}) relative to the calling object's parent. The focal points of the ellipse are at the following points:

Parameters: {xoffset} The x-position of the center of the ellipse (relative to the calling object's parent). {yoffset} The y-position of the center of the ellipse (relative to the calling object's parent). {a} The distance along the primary focal point vector from the center to the edge of the ellipse (relative to the calling object's parent). {xfocal} The horizontal distance from the center to the primary focal point of the ellipse (relative to the calling object's parent).

({xoffset} + {xfocal} and {yoffset} + {yfocal}) ({xoffset} – {xfocal} and {yoffset} – {yfocal}) The mathematical definition of an ellipse is that the sum of the distances from the focal points to any point on the ellipse is a constant. In this case, the constant is defined as “2∗{a}.” The elliptical arc is drawn counterclockwise from “{theta}” to “{gamma}.” The simplest way to draw a closed ellipse is to draw a circle. Set “{theta}” to “0” and “{gamma}” to “2∗PI” (PI is a constant defined as 3.14159). A circle is an ellipse with both focal points at the center. To draw a circular arc, set “{a}” to the desired radius, and set “{xfocal}” and “{yfocal}” to “0.” To draw the complete circle, also set “{theta}” to “0,” and set “{gamma}” to “2∗PI.”

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 62

50

QSI Qlarity-based Terminal Programmer’s Reference

X

Center (<xoffset>, yoffset>)

gam ma

<yfocal>

{maxup} An integer to receive the maximum distance from the center to the top edge of the ellipse.

<xfocal>

Primary focal point

Y

{maxleft} An integer to receive the maximum distance in pixels from the center to the left edge of the ellipse. {maxright} An integer to receive the maximum distance from the center to the right edge of the ellipse.

theta

Secondary focal point

Parameters:

Primary focal point vector (length a)

The “{flags}” parameter has type “ellipse_flags,” which is an enumerated type with the following legal values: ELLIPSE_NORMAL Draw the specified arc in the foreground color. ELLIPSE_FILL Draw the specified arc in the foreground color, and fill the arc with the background color. If only this flag is specified, the boundaries of the filled region are the arc and a line segment connecting the endpoints of the arc. (Also known as ELLIPSE_CONNECT_ENDS.) ELLIPSE_CONNECT_CENTER Draw line segments connecting the endpoints of the arc to the center in the foreground color. ELLIPSE_CONNECT_ENDS Draw a line segment connecting the endpoints of the arc in the foreground color. Multiple flags may be specified by combining them with a boolean AND operation. 4.6.17 GetEllipseSize Syntax: getellipsesize(maxleft as reference to -> integer, maxright as reference to integer, maxup as reference to integer, maxdown as -> reference to integer, a as float, xfocal -> as float, yfocal as float, theta as float,-> gamma as float, flags as ellipse_flags)

{maxdown} An integer to receive the maximum distance from the center to the bottom edge of the ellipse. {a} The distance along the primary focal point vector from the center to the edge of the ellipse. {xfocal} The horizontal distance from the center to the primary focal point of the ellipse. {yfocal} The vertical distance from the center to the primary focal point of the ellipse. {theta} The angle (in radians) from the primary focal point vector segment to the starting point of the arc. Positive angles increase counter-clockwise from the primary focal point vector segment. {gamma} The angle (in radians) from the primary focal point vector segment to the ending point of the arc. Positive angles increase counter-clockwise from the primary focal point vector segment. {flags} A value of type “ellipse_flags” (see section 4.6.16, “DrawEllipse”) that determines how the ellipse is drawn. Description: This function determines the size of an elliptical arc relative to its center. The size is determined from the major axis, focal point, starting angle, and ending angle.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 63

QSI Qlarity-based Terminal Programmer’s Reference

4.6.18 GetScreenPixmap Syntax: getscreenpixmap(x as integer, y as -> integer, width as integer, height as -> integer) returns color[]

Parameters: {x} The x-position of the first screen location to read (relative to root). {y} The y-position of the first screen location to read (relative to root). {width} The width indicates how many pixels per row should be copied from the screen. {height} The height indicates how many pixels per column should be copied from the screen. Description: This function is used to retrieve the pixel map for a section of the screen as it is currently drawn. This pixel map indicates the individual colors drawn up to this point in each pixel location of the screen. The returned array will be a color array of size "width * height", indicating the colors drawn so far. Please note that for grayscale units, the color returned may not be the exact color that was drawn to that location (but it will map to the same gray color as the original). The color drawn at pixel coordinate x,y in the object (with 0,0 being the top left pixel of the object) has the color indicated by the "((y * width) + x)"-th element in the returned array. Any requests for an area off of the screen will be transparent when drawn using drawpixmap. 4.6.19 UseDrawCache Syntax: usedrawcache(cachelevel as anytype)

51

Description: This function sets the method of draw caching which is used by the system software to improve graphics performance. The parameter “{cachelevel}” is of type “drawcache_level” and can take on any one of the following values: CACHE_OFF Disables draw caching. CACHE_ALL Maintains a cache for all objects in the application (best performance, highest memory requirement). CACHE_ENABLED Maintains a cache for all enabled objects (intermediate performance and memory requirement). CACHE_EFFECTIVE_ENABLED Only maintains a cache for objects that are both enabled and their ancestors are enabled (tracing back to root). Thus, the level of draw caching can be tailored to the memory requirements of the application. DEPRECATED USAGE: This function will also accept a boolean value. A value of “true” for “{cachelevel}” selects CACHE_ALL, and a value of “false” selects CACHE_OFF. 4.6.20 IgnoreDrawCache Syntax: ignoredrawcache(obj as objref, ignore as -> boolean)

Parameters: {obj} A reference to the object desiring to change status. {flag} A boolean flag containing the desired status. A value of "true" sets the object to ignore the drawcache setting, and a value of "false" sets the object to use the drawcache setting (the default setting).

Parameters: {cachelevel} Selects the method for draw caching (see below).

Description: This function is used to cause an object to ignore the drawcache settings so it will always get a draw when another object is drawn in its area.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770

Page 64

52

QSI Qlarity-based Terminal Programmer’s Reference

4.6.21 DrawBorder Syntax: drawborder (x1 as integer, y1 as integer, -> x2 as integer, y2 as integer, style as -> integer, drawFlags as unibyte)

Parameters: {x1} The left edge of the border. {y1} The top edge of the border. {x2} Either the right edge of the border, or the width of the border rectangle, depending on whether BDR_WIDTHHEIGHT was specified for the drawFlags parameter. {y2} Either the bottom edge of the border, or the height of the border rectangle, depending on whether BDR_WIDTHHEIGHT was specified for the drawFlags parameter. {style} A special integer value that specifies how the border is to be drawn. Rather than specify your own value for this parameter, you should use either a value created by the PC development tool's border editor and stored in the _stylemap array, or you should use a value returned from the _CreateBorderStyle function. {drawFlags} Flags which modify how the border is drawn. See the description below. Description: This API allows objects to draw complex borders with ease. To use this function, specify the boundary rectangle for your border as well as a border style. In general, you should use either _CreateBorderStyle() to create a border style, or you should pass in a value that was stored in the global array _styleMap (this array is only available for workspaces created using the PC development tool). This style defines such things as whether the border is flat, or 3d, the border width, the corner radius, etc. The drawFlags parameter is one or more of the following values combined using the OR operator:

BDR_FILL Fill the interior of the border rectange with the current background color BDR_WIDTHHEIGHT If specified, the x2 and y2 parameters represent the width and height of the border rectangle. Otherwise, x2 and y2 are the right and bottom edges of the border rectangle. BDR_CLEARCURVES For rounded borders, this flag removes any drawing that may have occurred in the rectangle specified by x1, y1, x2 and y2, but outside the corner radius (i.e. it erases any drawing in the corners of the border when using a curved border). This is intended for objects drawing their outside border where previous drawing code may have drawn outside the border. BDR_INVERSE Draw the border in inverse. This causes raised borders to appear sunken, and sunken borders to appear raised. Flat borders draw using their natural inverse color. BDR_FGCURVES This option is occasionally used for borders on the interior of an object. Specify this option with a rounded border to cause the area inside the border rectangle but outside of the curves to be filled in with the foreground color. 4.6.22 GetObjPixmapRegion Syntax: getobjpixmapregion (x as integer, y as -> integer, width as integer, height as -> integer)

Parameters: {x} The x-position of the first pixel to read (relative to the object). {y} The y-position of the first pixel to read (relative to the object). {width} The variable passed in as width should contain the desired width of the resultant pixmap.

QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770