DOKK / manpages / debian 12 / ivtools-dev / Painter.3i.en
Painter(3I) InterViews Reference Manual Painter(3I)

Painter - graphics output

#include <InterViews/painter.h>

Painter is a class that provides ``immediate-mode'' graphics operations for drawing on a canvas. The state of a painter defines the graphics context for the drawing operations and includes a brush, foreground and background colors, a fill pattern and mode, a text font, a text style, an output origin and current position, and a transformation matrix.

Create a new painter and copy its state from the given painter.
Set or return the painter's brush. Default is the predefined brush ``single''.
Set or return the painter's colors. If either argument to SetColors is nil, then the corresponding color is not changed. Defaults are ``black'' for foreground and ``white'' for background.
Set or return the painter's text font. Default is the predefined font ``stdfont''.
Set or get the painter's text style. A text style is a bit vector that can be assembled from the predefined constants Plain, Boldface, Underlined, and Reversed. Default is Plain.
Set or return the painter's fill pattern and mode. If the mode is true, fill operations will set pixels corresponding to ones in the current fill pattern to the foreground color and pixels corresponding to zeros to the background color. If false, then only foreground pixels will be set. Default pattern is ``solid''; default mode is true.
Set or return the origin by which all coordinates are offset. Default is (0, 0).
Coordinates passed to drawing operations are transformed according to the current origin, translation (cumulative), rotation, and scale factor. Internally, a transformation matrix is stored that can be directly set and accessed using SetTransformer and GetTransformer. The default transformer is nil, meaning no transformations are performed.
Set which bit planes are affected by drawing operations. If the Kth bit of mask is set, then display operations will draw on plane K.
Set whether a painter is allowed to write in subcanvases. If true, drawing operations will be able to write over the canvases of component interactors. If false, drawing operations will be clipped by any subcanvases. The default is false.
Clip restricts output operations to the specified region of the canvas. NoClip removes the restriction so that operations affect the entire canvas. Only one clipping region may be in effect at a time.
Set the current output position. The output position is used and updated by Text and CurveTo.

Paint a Bezier curve on the canvas from the first point to the last point (but not going through the intermediate control points). The curve will lie within the polygon formed by the four points. CurveTo uses the current position for the first point.
Draw the B-spline defined by the n control vertices. If closed or filled, the last point is connected to the first point.
Draw a circle with center (xy) and radius r.
Draw an ellipse with center (xy), horizontal radius xr, and vertical radius yr.
Draw a path using the current brush and colors. The Line operation draws a vector between two points (inclusive); MultiLine draws a number of connected vectors; Polygon draws a closed set of vectors; FillPolygon fills the area inside a polygon using the current fill pattern and colors.
Set a point or set of points to the current foreground color.
Draw a rectangle with opposite corners specified by (x1y1) and (x2y2). FillRect fills the rectangle using the current pattern and colors; ClearRect fills the rectangle with the background color.
Draw a string or substring of text using the current Font and text style. The (xy) coordinates specify the lower-left corner of the bounding box of the text. The width of the bounding box is the width of the string as reported by the Font::Width operation, and the height of the bounding box is the Font height. Most fonts will result in output which only affects pixels within the bounding box. The current transformation matrix is applied to both the positions and the shapes of characters drawn. If the matrix specifies a transformation involving rotation or scaling, the resulting operation may proceed much more slowly than normal. If background fill mode is on, then the characters are drawn in the foreground color, and other pixels within the bounding box are set to the background color. If background fill mode is off, only the foreground pixels are set. If no coordinates are specified, then the current position (defined by MoveTo) is used and updated to reflect the lower-right corner of the bounding box.
Paint foreground and background colors through a stencil formed by positioning the image and mask Bitmaps with their origins at the point (xy). Foreground color is painted where the image Bitmap has a true value and background color where image is false. However, only pixels corresponding to a true value in the mask Bitmap are affected. A nil mask is equivalent to a mask of the same size and shape as image and containing all true values. The current transformation matrix is applied to both the image and mask Bitmaps. If the matrix specifies a transformation involving rotation or scaling, the resulting operation may proceed much more slowly than normal.
Render the Raster with its lower-left corner at the position (xy). The current transformation matrix is applied to the Raster. If the matrix specifies a transformation involving rotation or scaling, the resulting operation may proceed much more slowly than normal.
Read copies a region of a canvas into memory. Write copies data from memory to a region of a canvas. Copy reads a region of one canvas and writes the data into a region of another canvas (or within a canvas if src and dst are the same). The point (x0y0) is the lower-left corner of the destination region. Note that Read and Write are superseded by operations that use Rasters.

Bitmap(3I), Brush(3I), Canvas(3I), Color(3I), Font(3I), Pattern(3I), Raster(3I), Transformer(3I)

15 June 1987 InterViews