>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User

gl2 commands 11!:2000+n

Lab "Graphics - gl2 commands" gives an overview of the isigraph control and gl2 commands. See the other graphics labs for information on other aspects of gl2.

gl2 commands are defined in the jgl2 locale by gl2.ijs.

When an isigraph control requires painting the paint event is called. If the isigraph control is called g and it is in form abc, then verb abc_g_paint is called in the form's locale.

In the paint event the drawing commands are done to a memory context and when the paint event ends this memory context is copied to the isigraph screen surface.

Drawing command coordinates are in pixels where 0 0 is the upper left corner and positive x and y values are to the right and down.

A printer context can be created as the target for commands. The drawing units when commands target a printer context are in twips (twentieths of a point).

isigraph events allow user interaction with the isigraph control with the keyboard and mouse.


gl2 Commands

glarc x y w h xa ya xz yz ; draw arc on the ellipse defined by rectangle. Arc starts at xa,ya and ends at xz,yz. Start and end points need not lie on the ellipse, they define a line from the center that intersects the ellipse.

glbrush '' ; select solid brush in current color

glbrushnull '' ; select null brush (leaves area painted with it unchanged)

glcapture type ; mouse capture.  A capture is normally done in a mouse down event and a glcapture 0 is done in the mouse up. There are mmove events during a capture.
   0   release
   1   capture (no drawing)
   2   line
   3   box
   4   ellipse
   5   vertical line
   6   horizontal line
   7 8 9  followed by one or more rectangles. Type 7 boxes are moved. Type 8 boxes are resized. Type 9 defines new boxes and is normally done in the move event of a 7 or 8 capture.
  10   cross hairs with optional clipping rectangle

glcaret x y w h ; create a text caret at x,y with a width and height of w h.

glclear ; Clear memory buffer to white and initialize context: default system font; glrgb 0 0 0; glpen 1 0; glnullbrush''; gltextxy 0 0; gltextcolor''; glclipreset''; glwindoworg 0 0 .

glclip x y w h ; intersect this rectangle with the original clip rectangle to restrict drawing

glclipreset ; restore original clip rectangle

glcmds ... ; takes a series of gl2 commands. Each command starts with an integer count followed by the command and data. Commands that return results can not be used in glcmds. Character data is passed as integer values.
   glcmds 4 2056 100 100 6 2038 , a.i.'test' NB. gltextxy , gltext

glcursor n ; sets mouse cursor. Values are defined as IDC_... in gl2.ijs.

glellipse x y w h ; draw an ellipse in the rectangle with pen and brush

glemfopen ; (only win32) open file set by glfile as an enhanced metafile and set it as the context to which gl2 commands will draw

glemfclose ; (only win32) Close the file and context opened by glemfopen.

glemfplay .... ; (only win32) play enhanced metafile set by glfile in the current context. An arg of x y plays the file at that location in its true size. An arg of x y w h plays the file scaled to fit the rectangle.

glfile filename ; (only win32) set filename for glemfopen and glemfplay.

glfont  fontspec ; font for text commands

gllines pts ; draw connected lines. pts is 0 or more points.

glnodblbuf b ; turns off double buffering (drawing to memory context). Drawing commands draw directly to the screen surface. Used only by formedit and probably should be avoided.

glpaint ; copy memory buffer to screen

glpen i [style] ; select pen. pen color is from last glrgb and is i units wide. style is from the gl2.ijs PS_...

glpie x y w h xa ya xz yz ; draw pie shaped wedge with pen and brush. Same parameters as garc.

glpixel i j ; draw pixel at i,j in current color

glpixels x y w h pixeldata ; pixeldata is an integer per pixel with RGB values. If h is positive  pixeldata is drawn top to bottom and otheriwse it is drawn from bottom to top.

glpixelsx x y w h address ; same as glpixels except the argument has the memory address of pixeldata.

glpolygon pts ; draw polygon in pen and brush

glprint [jobname [printer [filename [modes values...]]]]; jobname appears in the print queue. The default jobname is "J Print". printer is from wd'qprinters' and "" is the 1st entry. filename is for a print to file. Remaining parameters are name/value pairs. Possible names are: orientation copies papersize paperlength paperwidth scale defaultsource printquality color duplex. For example:
   glprint ''  NB. empty jobname on default printer
   glprint ' "myjob" "Epson Stylus Photo 750" "" '
   glprint ' "myjob" "" "" orientation 2 copies 3'


Jwdp requires printer and filename to be "" and only supports orientation and copies.

glprintmore n ; 0 indicates no more to print.

glqextent text ; return width and height text

glqextentw texts ; return widths for LF delimited texts

glqhandles ''  ; Jwdw returns hwnd, hdc for hwnd, and hdc for drawing. Jwdp returns hwnd, 0, 0. Used in OpenGL support and probably should be restricted to that use.

glqpixels x y w h; return pixeldata as integer per pixel with RGB values

glqprintpaper '' ; return width, height, offset to left printable area, offset to top printable area, orientation, copies, and papersize. Measurements are in twips. Must be run in a print event.

glqprintwh '' ; return width and height of the printer image in twips. Must be run in a print event.

glqtextmetrics '' ; return font information: Height, Ascent, Descent, InternalLeading, ExternalLeading, AverageCharWidth, MaxCharWidth

glqwh '' ; return width and height of the control in pixels

glrect x y w h ; draw rectangle with pen and brush

glrgb color ; set current color

glroundr x y w h rw rh ; draw rectangle with rounded corners defined by ellipse with width rw and height rh

glsel id ; select isigraph child of currently selected parent for graphic commands

glsel hwndc ; hwndc is the result of wd'qhwndc' for an isigraph control. Parent and child are selected as the wd and gl command targets.

gltext text ; write text in glfont and gltextcolor at gltextxy

gltextcolor '' ; glrgb color is set as color of text for gtext

gltextxy x y ; position for gltext

glwindoworg x y ; changes origin: that is, x and y are automatically added to subsequent command coordinates

>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  User