20.6 Graphics Interface

ORIGIN 'guienv';
LIB_ITEM 'guienv';
BODY 'private/graphicsbody'
(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics, 1991-96
 *       All rights reserved.
 *)
-- windowitemLib: attributes --
graphics: 
  (* The graphics pattern is intended to implement a basic drawing
   * facility for canvases.
   * 
   * THIS IS A PROPOSAL FOR EXTENDING "GUIENV", based on previous
   * discussions in the "GUIENV" design "team".
   * 
   * The intended usage it for temporary drawings (i.e. non-permanent
   * in the sence of not automatic refresh etc., and non-interactive).
   * Can be used e.g. in the definition of borders, etc. on
   * interfaceObjects (if you make the graphics drawn on each refresh
   * of the interfaceObject).  Can be used for decorations, and for
   * grouping interfaceObject by enclosing them in a box etc.
   *)
  (# <<SLOT graphicsLib: attributes>>;
     
     overrideChildren:< 
       (* If overrideChildren is furtherbound to return
        * TRUE, the drawings will overlay the children
        * of THIS(windowItem)
        *)
       booleanValue;
     pen: @
       (* defines the besic characteristics of the pen used for
        * drawing
        *)
       (# size: 
            (# value: @integer;
            enter value do ...
            #);
          foregroundColor:
            (# theColor: @color;
            enter theColor do ...
            #);
          backgroundColor:
            (# theColor: @color;
            enter theColor do ...
            #);
          stipple: 
            (# b: ^pixmap;
            enter b[] do ...
            #);
          mode:
            (* The transfer mode use specifies how new graphics are
             * mixed with the graphics already in the window
             *)
            (# m: @integer;
            enter m
            do ...
            #);
       #);
     style:
       (* The textstyle used for drawing text.*)
       (# theTextStyle: ^textStyle
       enter theTextStyle[]
       do ...;
       #);
     move:
       (* move the pen to current position"+"p, without drawing
        * anything
        *)
       (# p: @point
       enter p do ...
       #);
     moveTo:
       (* move the pen to position p, without drawing anything *)
       (# p: @point
       enter p do ...
       #);
     draw:
       (* move the pen to current position"+"p, drawing a straigh
        * line between current position and the new position
        *)
       (# p: @point
       enter p do ...
       #);
     drawTo:
       (* move the pen to position p, drawing a straigh line between
        * current position and the new position
        *)
       (# p: @point
       enter p do ...
       #);
     drawSpot: 
       (* Draws a single point *)
       (# p: @point
       enter p do ...
       #);
     drawSpots:
       (* Draw an Array of points *)
       (# points: [0] ^point;
       enter points
       ...
       #);
     drawLine: 
       (* draws a line from p1 to p2. The pen position is not
        * affected
        *)
       (# p1, p2: @point
       enter (p1,p2) do ...
       #);
     drawText: 
       (* Draws the text from the current pen-position, using the
        * drawing characteristics of the pen (tile, color etc.)
        *)
       (# t: ^text
       enter t[] do ...
       #);
     drawPolygon: 
       (# points: [3] ^point
       enter points do ...
       #);
     drawRect: 
       (# r: @rectangle
       enter r do ...
       #);
     drawRoundRect: 
       (# r: @rectangle; roundness: @rectangle
       enter (r, roundness) do ...
       #);
     drawOval: 
       (# r: @rectangle
       enter r do ...
       #);
     drawSlice: 
       (# r: @rectangle; fromAngle, toAngle: @integer
       enter (r, fromAngle, toAngle) do ...
       #);
     fillPolygon: 
       (# points: [3] ^point
       enter points do ...
       #);
     fillRect: 
       (# r: @rectangle
       enter r do ...
       #);
     fillRoundRect: 
       (# r: @rectangle; roundness: @rectangle
       enter (r, roundness) do ...
       #);
     fillOval: 
       (# r: @rectangle
       enter r do ...
       #);
     fillSlice: 
       (# r: @rectangle; fromAngle, toAngle: @integer
       enter (r, fromAngle, toAngle) do ...
       #);
     drawRaster: 
       (# p: ^pixmap;
          from,to: @point;
          width,height: @integer;
       enter (p[],from,to,width,height) do ... 
       #);
     private: @...;
  do ...;
  #)


20.6 Graphics Interface
© 1994-2002 Mjølner Informatics
[Modified: Monday August 24th 1998 at 13:50]