ST BASIC VDI CALLS
Part II: Text & Graphics
by JAMES LUCZAK
In this issue, we provide the concluding 520ST Text and Graphics VDI calls which were left out last month due to lack of space.
Control GEM With ST BASIC, in the April, 1986 ST Resource, explained how to access VDI (Virtual Device Interface) calls from ST BASIC. An included demonstration program showed how some of these VDI routines serve as building blocks for the GEM desktop functions. We also published the ST BASIC code for two groups of VDI functions--Polymarkers and Polylines.
This month we complete this feature with the ST BASIC access codes for VDI functions in the Text and Graphics groups.
At this writing, Abacus Software has just released its GEM Programmers' Reference Guide ($19.95) which lists and explains all AES as well as VDI functions. (See review of two other Abacus ST reference books in this issue.) Although the book is aimed at C and assembly language programmers, you can combine its value tables with the concepts from these ST Resource articles to access the GEM AES routines.
TEXT INQUIRE TEXT ATTRIBUTES BASIC CODE DESCRIPTION 1 poke contrl,38 OPCODE 2 poke contrl+2,0 3 poke contrl+6,0 4 vdisys(l) 5 a=peek(intout) Text Face 6 b=peek(intout+2) Text Color Index (SEE COLOR INDEX) 7 c=peek(intout+4) Angle of rotation of baseline 8 d=peek(inout+6) Horizontal Alignment 9 e=peek(intout+8) Vertical Alignment 10 f=peek(intout+l0) Writing Mode 11 g=peek(ptsout) Character Width 12 h=peek(ptsout+2) Character Height 13 i=peek(ptsout+4) Character Ceil Width 14 j=peek(ptsout+6) Character Cell Height 15 vdisys(l) NOTE: You need only PEEK at the attributes that are of interest to you. COLOR INDEX COLOR PIXEL INDEX COLOR VALUE 0 White 0 1 Black 15 2 Red 1 3 Green 2 4 Blue 4 5 Cyan 6 6 Yellow 3 7 Magenta 5 8 Low White 7 9 Grey 8 10 Light Red 9 11 Light Green 10 12 Light Blue 12 13 Light Cyan 14 14 Light Yellow 11 15 Light Magenta 13 SET TEXT ALIGNMENT BASIC CODE DECRIPTION 1 poke contrl,39 OPCODE 2 poke contrl+2,0 3 poke contrl+6,2 4 poke intin,x HORIZONTAL ALIGNMENT 0=Left Justified (DEFAULT) 1=Center Justified 2=Right Justified 5 poke Intin+2,x VERTICAL ALIGNMENT 0=Baseline (DEFAULT) 1=Half Line 2=Ascent Line 3=Botton 4=Descent 5=Top 6 vdisys(l) NOTE: Text alignment affects the text within the CHARACTER CELL. SET TEXT COLOR INDEX BASIC CODE DESCRIPTION 1 poke contrl,22 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Color Index (SEE COLOR INDEX) 5 vdisys(1) NOTE: Text alignment affects the text within the CHARACTER CELL. SET TEXT SPECIAL EFFECTS BASIC CODE DESCRIPTION 1 poke contrl,106 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Special Effects word 5 vdisys(1) The SPECIAL EFFECTS WORD is a 6 bit word. Below is the word breakdown. BIT FUNCTION BIT=0 BIT=1 BINARY VALUE 0 THICKENED Not Thickened Thickened 1 1 INTENSITY Normal Light 2 2 SKEWED Not Skewed Skewed 4 3 UNDERLINED Not Underlined Underlined 8 4 OUTLINED Not Outlined Outlined 16 5 SHADOW Not Shadowed Shadowed 32
EXAMPLE: To have THICKENED text give X in LINE 4 a value of 1. To have UNDERLINED and SKEWED text give X a value of 12.
SET CHARACTER HEIGHT ABSOLITE MODE BASIC CODE DESCRIPTION 1 poke contrl,12 OPCODE 2 poke contrl+2,1 3 poke contrl+6,0 4 poke ptsin,0 5 poke ptsin+2,x X=Character Height in vertical units. 6 vdisys(1)
NOTE: In the ABSOLUTE mode, the text HEIGHT is the distance from the BASELINE to the top of the CHARACTER CELL. (SEE POINTS MODE).
SET CHARACTER HEIGHT POINTS MODE BASIC CODE DESCRIPTION 1 poke contrl,l07 CODE 2 poke contrl+2,0 3 poke contrl+6,l 4 poke intin,x X=Character Cell Height in vertical units. 5 vdisys(1)
NOTE: In the POINTS mode, the character cell HEIGHT is the distance between the BASELINE of one line of text and the BASELINE of the next line of text, which is the character cell height.
SET CHARACTER BASELINE VECTOR BASIC CODE DESCRIPTION 1 poke contrl,13 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Angle of Baseline 5 vdisys(1) ANGLE OF BASELINE 0 Text will start on LEFT of screen and go to the RIGHT. 900 Text will start at the BOTTOM of the screen and go to the TOP. 1800 Text will start at the RIGHT of the screen and go to the LEFT (UPSIDE DOWN) 2700 Text will start at the TOP of the screen and go to the BOTTOM.
NOTE: The ANGLE OF BASELINE is expressed in tenths of 8 degree. Examples of valid values are listed below.
SET WRITING MODE BASIC CODE DESCRIPTION 1 poke contrl,32 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Writing Mode 1=Replace 2=Transparent 3=Xor 4=Reverse Transparent 5 vdisys(1) GRAPHICS ARC BASIC CODE DESCRIPTION 1 poke contrl,11 OPCODE 2 poke contrl+2,4 3 poke contrl+6,2 4 poke contrl+l0,2 PRIMITIVE ID 5 poke intin,x X=Start Angle 6 poke intin+2,y Y=End Angle 7 poke ptsin,x X=Coordingte of center point of ARC 8 poke ptsin+2,y Y=Coordinate of center point of ARC 9 poke ptsin+4,0 10 poke ptsin+6,0 11 poke ptsin+8,0 12 poke ptsin+l0,0 13 poke ptsin+l2,x X=Radius in horizontal units 14 poke ptsin+l4,0 15 vdisys(1) ATTRIBUTES: Color Line Type Line Width Writing Mode End Style NOTE: Angles are expressed in TENTHS OF DEGREES. (0--3600) BAR BASIC CODE DESCRIPTION 1 poke contrl,11 OPCODE 2 poke contrl+2,2 3 poke contrl+6,0 4 poke contrl+10,1 PRIMITIVE ID 5 poke ptsin,x X=Coordinate of corner of BAR 6 poke ptsin+2,y Y=Coordinate of corner of BAR 7 poke ptsin+4,x1 X1=Coordinate of corner diagonally opposite coordinate 8 poke ptsin+6,y1 Y1=Coordinate of corner diagonally opposite coordinate 9 vdisys(1) ATTRIBUTES: Interior Style Style Index Writing Mode Fill Color Perimeter Style CIRCLE BASIC CODE DESCRIPTION 1 poke contrl,11 OPCODE 2 poke contrl+2,3 3 poke contrl+6,0 4 poke contrl+l0,4 PRIMITIVE ID 5 poke ptsin,x X=Coordinate of center point of CIRCLE 6 poke ptsin+2,y Y=Coordinate of center point of CIRCLE 7 poke ptsin+4,0 8 poke ptsin+6,0 9 poke ptsin+8,r R=Radius in horizontal units 10 poke ptsin+10,0 11 vdisys(1) ATTRIBUTES: Interior Style Style Index Writing Mode Fill Color Perimeter Styie CONTOUR FILL BASIC CODE DESCRIPTION 1 poke contrl,103 OPCODE 2 poke contrl+2,1 3 poke contrl+6,l 4 poke intin,c C=Color Index that defines the contour 5 poke ptsin,x X=Coordinate of starting point 6 poke ptsin+2,y Y=Coordinate of starting point 7 vdisys(1)
CONTOUR FILL fills an area until it finds the edges of the display the color index given in LINE 4. If the index given in LINE 4 is negative, the function searches for any color other then the color of the seed point. CONTOUR FILL is sometimes refered to as a FLOOD FILL or SEED FILL.
ATTRIBUTES: Interior Style Style Index Writing Mode FillColar ELLLIPTICAL ARC AND ELLlPTICAL PIE SLICE BASIC CODE DESCRIPTION 1 poke contrl, 11 OPCODE 2 poke contrl+2,2 3 poke contrl+6,2 4 poke contrl+l0,i PRIMITIVE ID 6=Elliptical ARC 7=Elliptical PIE SLICE 5 poke intin,a A=Start Angle 6 poke intin+2,a1 A1=End Angle 7 poke ptsin,x X=Coordinate of center point 8 poke ptsin+2,y Y=Coordinate of center point 9 poke ptsin+4,xr XR=Radius of X-AXIS 10 poke ptsin+6,yr YR=RadiuS of Y-AXIS 11 vdisys(1) ATTRIBUTES: Elliptical Arc Elliptical Pie Slice Color Color Line Type Interior Style Line Width Style Index Writing Mode Writing Mode End Style Perimeter Style
NOTE: Angles are expressed in TENTHS OF DEGREES (0-3600). Start angle to end angle is expressed in a COUNTERCLOCK-WISE DIRECTION.
ELLIPSE BASIC CODE DESCRIPTION 1 poke contrl,11 OPCODE 2 poke contrl+2,8 3 poke contrl+6,0 4 poke contrl+l0,5 PRIMITIVE ID 5 poke ptsin,x X=Coordinate of center point of ELLIPSE 6 poke ptsin+2,y Y=Coordinate of center point of ELLIPSE 7 poke ptsin+4,xr XR=Radius of X-AXIS 8 poke ptsin+6,yr YR=Radius of Y-AX1S ATTRIBUTES: Color Interior Style Style Index Writing Mode Perimeter Style FILL AREA BASIC CODE DESCRIPTION 1 poke Contrl,9 OPCODE 2 poke contrl+2,num NUM=Number of X & Y pairs in the polygon. 3 poke contrl+6,0 4 poke ptsin,x X=Coordinate of first point of polygon. 5 poke ptsin+2,y Y=Coordinate of first point of polygon. 6 poke ptsin+4,x1 X1=Coordinate of second point of polygon. 7 poke ptsin+6,y1 Y1=Coordinate of second point of polygon. 8 vdisys(1)
The FILL AREA function will fill a complex polygon. The polygon to be filled is specified in LINES 4 thru 7. This function is the same as the POLYLINE function, except that it will fill the specified polygon. (See POLYLINE)
ATTRIBUTES: Color Interior Style Style Index Writing Mode NOTE: See EXTENDED INQUIRE for maximum number of lines in POLYGON. GET PIXEL VALUE BASIC CODE DESCRIPTION 1 poke contrl,105 OPCODE 2 poke contrl+2,1 3 poke contrl+6,0 4 poke ptsin,x X=Coordinate of PIXEL 5 poke ptsin+2,y Y=Coordinate of PIXEL 6 vdisys(1) 7 a=peek(intout) Pixel Value 8 b=peek(intout+2) Color lndex 9 vdisys(1) NOTE: See COLOR INDEX for Pixel Value, and Color Index information. ROUNDED RECTANGLE AND FILLED ROUNDED RECTANGLE BASIC CODE DESCRIPTION 1 poke contrl,11 OPCODE 2 poke contrl+2,2 3 poke contrl+6,0 4 poke contrl+l0,x PRIMITIVE ID 8=Rounded Rectangle 9=Filled Rounded Rectangle 5 poke ptsin,x X=Coordinate of lower left corner of RECTANGLE 6 poke ptsin+2,y Y=Coordinate of lower left corner of RECTANGLE 7 poke ptsin+4,x1 X1=Coordinate of upper right corner of RECTANGLE 8 poke ptsin+6,y1 Y1=Coordinate of upper right corner of RECTANGLE 9 vdisys(1) ATTRIBUTES: Rounded Rectangle Filled Rounded Rectangle Color Color Line Type Interiour Style Line Width Style Index Writing Mode Writing Mode Perimeter Style Line Width INQUIRE COLOR REPRESENTATION BASIC CODE DESCRIPTION 1 poke contrl,26 OPCODE 2 poke contrl+2,0 3 poke contrl+6,2 4 poke intin,x X=Requested Color Index 0-15 Low 0-3 Medium 5 poke intin+2,1 6 vdisys(1) 7 a=peek(intout) Color Index 8 b=peek(intout+2) RED Intensity 9 c=peek(intout+4) GREEN Intensity 10 d=peek(intout+6) BLUE Intensity 11 vdisys(l) NOTE: Intensities are expressed in TENTHS OF PERCENT (0-1000). INQUIRE CURRENT FILL AREA ATTRIBUTES BASIC CODE DESCRIPTION 1 poke contrl,37 OPCODE 2 poke contrl+2,0 3 poke contrl+6,0 4 vdisys(1) 5 a=peek(intout) Interior Style 6 b=peek(intout+2) Color lndex 7 c=peek(intout+4) Style Index 8 d=peek(intout+6) Writing Mode 9 e=peek(intout+8) Perimeter Status 10 vdisys(1) FILL RECTANGLE BASIC CODE DESCRIPTION 1 poke contrl,114 OPCODE 2 poke contrl+2,2 3 poke contrl+6,0 4 poke ptsin,x X=Coordinate of corner of RECTANGLE 5 poke ptsin+2,y Y=Coordinate of corner of RECTANGLE 6 poke ptsin+4,x1 X1=Coordinate of corner diagonally opposite coordinate X 7 poke ptsin+6,y1 Y1=Coordinate of corner diagonally opposite coordinate Y 8 vdisys(1) ATTRIBUTES Color Interior Style Style Index Writing Mode SET COLOR REPRESENTATION BASIC CODE DESCRIPTION 1 poke contrl,14 OPCODE 2 poke contrl+2,0 3 poke contrl+6,4 4 poke intin,x X=Color Index 5 poke intin+2,r R=RED Intensity 6 poke intin+4,g G=GREEN Intensity 7 poke intin+6,b B=BLUE Intensity 8 vdisys(1) NOTE: Intensities are expressed in TENTHS OF PERCENT (0-1000). SET FILL COLOR INDEX BASIC CODE DESCRIPTION 1 poke contrl,25 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Color index(See COLOR INDEX) 5 vdisys(1) SET FILL PERIMETER VISIBILITY BASIC CODE DESCRIPTION 1 poke contrl,104 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Visibility Flag 0=lnvisible NON-ZERO=Visibile 5 vdisys(1)
This function allows you to turn the outline of a filled area on or off. The border of a fill area is drawn with a solid line with the current fill area color. When Visibility is OFF no border is drawn. DEFAULT is Visibility ON.
SET FILL INTERIOR STYLE BASIC CODE DESCRIPTION 1 poke contrl,23 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Fill Interior Style 0=Hollow 1=Solid 2= Pattern 3=Hatch 4=User defined 5 vdisys(1) SET FILL STYLE INDEX BASICCODE DESCRIPTION 1 poke contrl,23 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,x X=Fill Style Index for pattern or Hatch Interior 5 vdisys(1)
NOTE: There are 24 Styles for Pattern and 12 Styles for Hatch. See ST BASIC SOURCEBOOK for descriptions.
EXTENDED INQUIRE BASIC CODE DESCRIPTION 1 poke contrl,102 OPCODE 2 poke contrl+2,0 3 poke contrl+6,1 4 poke intin,1 Extended Inquire Values 5 vdisys(1) 6 a=peek(intout+2) A=Numder of Background colors in color palette 7 b=peek(intout+4) B=Text Effects Supported 8 c=peek(intout+14) C=Contour Fill Capability 9 d=peek(intout+16) D=Character Rotation Ability 0=None 1=90 Degree increments only 2=Arbitrary angles 10 e=peek(intout+l8) E=Number of writing modes available 11 f=peek(intout+22) F-Text alignment capability 0=No 1=Yes 12 g=peek(intout+28) G=Maximum number of polylines,polymarkers. 13 vdisys(l) NOTE: You need only PEEK at the attributes that are of interest to you.