Previous: Utilities for X Graphics, Up: X Graphics
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 a string, which is the X server's name for the desired color.
set-border-color
andset-mouse-color
immediately change the border and mouse-cursor colors.set-background-color
andset-foreground-color
change 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 callinggraphics-clear
on the window's device afterwards. Color names include both mnemonic names, like"red"
, and intensity names specified in the"#
rrggbb"
notation.
Operation
draw-arc
draws or fills an arc. An arc is a segment of a circle, which may have been stretched along the x- or y- axis to form an ellipse.The parameters x, y, radius-x and radius-y describe the circle and angle-start and angle-sweep choose which part of the circle is drawn. The arc is drawn on the graphics device with the center of the circle at the virtual coordinates given by x and y. radius-x and radius-y determine the size of the circle in virtual coordinate units.
The parameter angle-start determines where the arc starts. It is measured in degrees in an anti-clockwise direction, starting at 3 o'clock. angle-sweep determines how much of the circle is drawn. It too is measured anti-clockwise in degrees. A negative value means the measurement is in a clockwise direction.
Note that the angles are determined on a unit circle before it is stretched into an ellipse, so the actual angles that you will see on the computer screen depends on all of: radius-x and radius-y, the window size, and the virtual coordinates.
If fill? is
#f
then just the segment of the circle is drawn, otherwise the arc is filled in a pie-slice fashion.This draws a quarter circle pie slice, standing on its point, with point at virtual coordinates (3,5):
(graphics-opereration g 'draw-arc 3 5 .5 .5 45 90 #t)
These operations draw a circle (outline) or a filled circle (solid) at on the graphics device at the virtual coordinates given by x and y. These operations could be implemented trivially interms of the
draw-arc
operation.
These operations change the external and internal border widths of a window. Width must be an exact non-negative integer, specified in pixels. The change takes place immediately. Note that changing the internal border width can cause displayed graphics to be garbled; we recommend calling
graphics-clear
on the window's device after doing so.
Changes the font used when drawing text in a window. Font-name must be a string that is a font name known to the X server. This operation does not affect text drawn prior to its invocation.
Changes the shape of the mouse cursor. Shape-number is an exact non-negative integer that is used as an index into the mouse-shape font; when multiplied by 2 this number corresponds to an index in the file
/usr/include/X11/cursorfont.h.
These operations control the mapping of windows. They correspond directly to Xlib's
XMapWindow
andXWithdrawWindow
.
Changes the size of a window. Width and height must be exact non-negative integers. The operation corresponds directly to Xlib's
XResizeWindow
.This operation resets the virtual coordinate system and the clip rectangle.
Changes the position of a window on the display. X and y must be exact integers. The operation corresponds directly to Xlib's
XMoveWindow
. Note that the coordinates x and y do not take the external border into account, and therefore will not position the window as you might like. The only reliable way to position a window is to ask a window manager to do it for you.
This operation corresponds directly to Xlib's
XGetDefault
. Resource and property must be strings. The operation returns the character string corresponding to the association of resource and property; if no such association exists,#f
is returned.
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.
Returns a Scheme equivalent of the X font structure for the font named font-name. If the string font-name does not name a font known to the X server, or names a 16-bit font,
#f
is returned.
These procedures extract the components of the font description structure returned by the X graphics operation
font-structure
. A more complete description of these components appears in documentation of theXLoadQueryFont
Xlib call.start-index
is the index of the first character available in the font. Themin-bounds
andmax-bounds
components are structures of typex-character-bounds
, and thecharacter-bounds
component is a vector of the same type.
These procedures extract components of objects of type
x-character-bounds
. A more complete description of them appears in documentation of the
XLoadQueryFont
Xlib call.