Custom operations are invoked using the procedure
graphics-operation. For example,
(graphics-operation device 'set-foreground-color "blue")
These operations change the colors associated with a window. Color-name must be of one of the valid color specification forms listed below.
set-foreground-colorchange the colors to be used when drawing, but have no effect on anything drawn prior to their invocation. Because changing the background color affects the entire window, we recommend calling
graphics-clearon the window's device afterwards.
The foreground color affects the drawing of text, points, lines, ellipses and filled polygons.
Colors are specified in one of three ways:
- An integer
- This is the Win32 internal RGB value.
- By name
- A limited number of names are understood by the system. Names are strings, e.g.
"black". More names can be registered with the
- RGB (Red-Green-Blue) triples
- A triple is either a vector or list of three integers in the range 0–255 inclusive which specify the intensity of the red, green and blue components of the color. Thus
#(0 0 0)is black,
(0 0 128)is dark blue and
#(255 255 255)is white.
If the color is not available in the graphics device then the nearest available color is used instead.
Define the string name to be the color specified by spec. Spec may be any acceptable color specification. Note that the color names defined this way are available to any Win32 graphics device, and the names do not have to be defined for each device.
Color names defined by this interface may also be used when setting the colors of the Scheme console window, or the colors of Edwin editor windows.
Looks up a color previously defined by
define-color. This returns the color in its most efficient form for operations
Draw an ellipse. Left, top, right and bottom indicate the coordinates of the bounding rectangle of the ellipse. Circles are merely ellipses with equal width and height. Note that the bounding rectangle has horizontal and vertical sides. Ellipses with rotated axes cannot be drawn. The rectangle applies to the center of the line used to draw the ellipse; if the line width has been set to greater than 1 then the ellipse will spill outside the bounding rectange by half of the line width.
(graphics-operation device 'fill-polygon #(0 0 0 1 1 0))
draws a solid triangular region between the points (0, 0), (0, 1) and (1, 0).
The graphics device window is moved to the screen position specified by x and y.
The graphics device window is resized to the specified width and height in device coordinates (pixels). If a clip rectangle is in effect when this procedure is called, it is necessary to redefine the clip rectangle afterwards.
This operation sets the line width for future drawing of lines, points and ellipses. It does not affect existing lines and has no effect on filled polygons. The line width is specified in device units. The default and initial value of this parameter is 1 pixel.
This sets the window title to the string name. The window is given the name
"Scheme Graphics"at creation.
Sets the font for drawing text. Currently not well supported. If you can get a Win32 font handle it can be used here.
This operation copies the contents of the rectangle specified by source-x-left, source-y-top, width, and height to the rectangle of the same dimensions at destination-x-left and destination-y-top.