メインコンテンツまでスキップ

Requests: Drawing Operations

ClearToBackground​

window: WINDOW
x, y: INT16
width, height: CARD16
exposures: BOOL
Errors: Window, Value, Match

The x and y coordinates are relative to the window's origin, and specify the upper left corner of the rectangle. If width is zero, it is replaced with the current width of the window minus x. If height is zero, it is replaced with the current height of the window minus y. If the window has a defined background tile, the rectangle is tiled with a plane-mask of all ones and alu-function of Copy. If the window has background None, the contents of the window are not changed. In eithercase, if exposures is True, then one or more exposure events are generated for regions of the rectangle that are eithervisible or are being retained in a backing store.

It is a Match error to use an InputOnly window in this request.

CopyArea​

src-drawable, dst-drawable: DRAWABLE
gc: GCONTEXT
src-x, src-y: INT16
width, height: CARD16
dst-x, dst-y: INT16
Errors: Drawable, GContext, Match

Combines the specified rectangle of src-drawable with the specified rectangle of dst-drawable. The src-x and src-y coordinates are relative to src-drawable's origin, dst-x and dst-y are relative to dst-drawable's origin, each pair specifying the upper left corner of the rectangle. Src-drawable must have the same root and the same depth as dst-drawable (else a Match error).

If regions of the source rectangle are obscured and have not been retained by the server, or if regions outside the boundaries of the source drawable are specified, then the following occurs. If the dst-drawable is a window with a background of other than None, the corresponding regions of the destination are tiled (with plane-mask of ones and alu-function Copy) with that background. Regardless, if graphics-exposures in gc is True, GraphicsExposure events for the corresponding desitnation regions are generated.

If graphics-exposures if True but no regions are exposed, then a NoExposure event is generated.

GC components: alu-function, plane-mask, foreground, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask

CopyPlane​

scr-drawable, dst-drawable: DRAWABLE
GC:Gcontext
src-x, src-y: INT16
width, height: CARD16
dst-x, dst-y: INT16
bit-plane: CARD32
Errors: Drawable, GContext, Value, Match

Src-drawable must have the same root as dst-srawable (else a match error), but need not have the same depth. Bit-plane must have exactly one bit set. Effectively, that plane of the src-drawable and the fore-ground/background pixels in gc are combined to form a pixmap of the same depth as dst-drawable, and the equivalent of a CopyArea is performed, with all the same exposure semantics.

GC components: alu-function, plan-mask, foreground, background, subwindow-mode, graphics-exposures, clip-x-origin, clip-y-origin, clip-mask

PolyPoint​

drawable: DRAWABLE
gc: GCONTEXT
coordinate-mode: {Origin, Previous}
points: LISTofPOINT
Errors: Drawable, GContext, Value, Match

Combines the foreground pixel in gc with the pixel at each point in the drawable. The points are drawn in the order listed.

The first point is always relative to the drawable's origin; the rest are relative either to that origin or the previous point, depending on the coordinate-mode.

GCcomponents: alu-function, plane-mask, foreground,

subwindow-mode, clip-x-origin, clip-y-origin, clip-mask

PolyLine​

drawable: DRAWABLE
gc: GCONTEXT
coordinate-mode: {Origin, Previous}
points: LISTofPOINT
Errors: Drawable, GContext, Value, Match

Draws lines between each pair of points (point[i], point [i+1]). The lines are drawn in the order listed. The lines join correctly at all intermediate points, and if the first and last points coincide, the first and last lines also join correctly.

For any given line, no pixel is drawn more than once. If thin (zero line-width) lines intersect, the intersecting pixels are drawn multiple times. If wide lines intersect, the intersecting pixels are drawn only once, as though the entire PolyLine were a single filled shape.

The first point is always relative to the drawable's origin; the rest are relative either to that origin or the previous point, depending on the coordinate-mode.

GC components: alu-function, plane-mask, line-width, line-style, cap-style, join-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, background, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin, dash-offset,dash-list

PolySegment​

drawable: DRAWABLE
gc: GCONTEXT
segments: LISTofSEGMENT

where SEGMENT: [x1, y1, x2, y2: INT16]

Errors: Drawable, GContext, Match

For each segment, draws a line between [x1, y1] and [x2, y2]. The lines are drawn in the order listed. No joining is performed at coincident end points. For any given line, no pixel is drawn more than once. If lines intersect, the intersecting pixels are drawn multiple times.

GC components: alu-function, plane-mask, line-width, line-style, cap-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin,clip-mask GC mode-dependent components: foreground, background, tile, stipple,tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dash-list

PolyRectangle​

drawable: DRAWABLE
gc: GCONTEXT
rectangles: LISTofRECTANGLE
Errors: Drawable, GContext, Match

Draws the outlines of the specified rectangles, as if a five-point PolyLine were specified for each rectangle. The x and y coordinates of each rectangle are relative to the drawable's origin, and define the upper left corner of the rectangle.

The rectangles are drawn in the order listed. For any given rectangle, no pixel is drawn more than once. If rectangles intersect, the intersecting pixels are drawn multiple times.

GC components: alu-function, plane-mask, line-width, line-style, join-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, background, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dash-list

PolyArc​

drawable: DRAWABLE
gc: GCONTEXT
arcs: LISTofARC
Errors: Drawable, GContext, Match

Draws circular or elliptical arcs. Each arc is specified by a rectangle and two angles. The x and y coordinates are relative to the origin of the drawable, and define the upper left corner of the rectangle. The center of the circle or ellipse is the center of the rectangle, and the major and minor axes are specified by the width and height, respectively. The angles are signed integers in degrees scaled by 64, with positive indicating counterclockwise motion and negative indicating clockwise motion. The start of the arc is specified by angle1 relative to the three-oclock position from the center, and the path and extent of the arc is specified by angle2 relative to the start of the arc. If the magnitude of angle2 is greater than 360 degrees, it is truncated to 360 degrees.

The arcs are drawn in the order listed. If the last point in one arc coincides with the first point in the following arc, the two arcs will join correctly. If the first point in the first arc coincides with the last point in the last arc, the two arcs will join correctly. For any given arc, no pixel is drawn more than once. If two arcs join correctly and the line-width is greater than zero and the arcs intersect, no pixel is drawn more than once. Otherwise, the intersecting pixels of intersecting arcs are drawn multiple times. Specifying an arc with one endpoint and a clockwise extent draws the same pixels as specifying the other endpoint and an equivalent counterclockwise extent, except as it affects joins.

By specifying one axis to be zero, a horizontal or vertical line can be drawn.

Angles are computed based solely on the coordinate system, ignoring the aspect ratio.

GC components: alu-function, plane-mask, line-width, line-style, cap-style, join-style, fill-style, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, background, tile, stipple,tile-stipple-x-origin, tile-stipple-y-origin, dash-offset, dash-list

FillPoly​

drawable: DRAWABLE
gc: GCONTEXT
shape: {Complex, Nonconvex, Convex}
coordinate-mode: {Origin, Previous}
points: LISTofPOINT
Errors: Drawable, GContext, Match, Value

Fills the region closed by the specified path. The path is closed automatically if the last point in the list does not coincide with the first point. No pixel of the region is drawn more than once.

The first point is always relative to the drawable's origin; the rest are relative either to that origin or the previous point, depending on the coordinate-mode.

The shape parameter may be used by the server to improve performance. Complex means the path may self-intersect.

Nonconvex means the path does not self-intersect, but the shape is not wholly convex. If known by the client, specifying Nonconvex over Complex may improve performance. If Nonconvex is specified for a self-intersecting path, the graphics results are undefined.

Convex means the path is wholly convex. If known by the client, specifying Convex can improve performance. If Convex is specified for a path that is not convex, the graphics results are undefined.

GC components: alu-function, plane-mask, fill-style, fill-rule, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin

PolyFillRectangle​

drawable: DRAWABLE
gc: GCONTEXT
rectangles: LISTofRECTANGLE
Errors: Drawable, GContext, Match

Fills the specified rectangles. The x and y coordinates of each rectangle are relative to the drawable's origin, and define the upper left corner of the rectangle.

The rectangles are drawn in the order listed. For any given rectangle, no pixel is drawn more than once. If rectangles intersect, the intersecting pixels are drawn multiple times.

GC components: alu-function, plane-mask, fill-style, fill-rule, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin

PolyFillArc​

drawable: DRAWABLE
gc: GCONTEXT
arcs: LISTofARC
Errors: Drawable, GContext, Match

For each arc, fills the region closed by the specified arc and one or two line segments, depending on the arc-mode. For Chord, the single line segment joining the endpoints of the arc is used. For PieSlice, the two line segments joining the endpoints of the arc with the center point are used. The arcs are as specified in the PolyArc request.

The arcs are filled in the order listed. For any given arc, no pixel is drawn more than once. If regions intersect, the intersecting pixels are drawn multiple times.

GC components: alu-function, plane-mask, fill-style, fill-rule, arc-mode, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin

PutImage​

drawable: DRAWABLE
gc: GCONTEXT
depth: CARD8
width, height: CARD16
dst-x, dst-y: INT16
left-pad: CARD8
format: {Bitmap, XYPixmap, ZPixmap}
bits: <bits>
Errors: Drawable, GContext, Match, Value, Alloc

Combines an image with a rectangle of the drawable. The dst-x and dst-y coordinates are relative to the drawable's origin.

If Bitmap format is used, then depth must be one (else a Match error) and the image must be in XYFormat. The foreground pixel in gc defines the source for one bits in the image, and the background pixel defines the source for the zero bits.

For XYPixmap and ZPixmap, depth must match the depth of drawable (else a Match error). For XYPixmap, the image must be sent in XYFormat. For ZPixmap, the image must be sent in the ZFormat defined for the given depth.

The left-pad must be zero for ZPixmap format. For Bitmap and XYPixmap format, left-pad must be less than bitmap-format-scanline-pad (as given in the server connection setup info). The first left-pad bits in every scanline are to be ignored by the server; the actual image begins that many bits into the data. The width argument defines the width of the actual image, and does not include left-pad.

GC components: alu-function, plane-mask, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, background

GetImage​

drawable: DRAWABLE
x, y: INT16
width, height: CARD16
plane-mask: CARD32
format: {XYFormat, ZFormat}

=>

depth: CARD8
visual: VISUALID or None
bits: <bits>
Errors: Drawable, Value, Match

Returns the contents of the given rectangle of the drawable in the given format. The x and y coordinates are relative to the drawable's origin, and define the upper left corner of the rectangle. If XYFormat is specified, only the bit planes specified in plane-mask are transmitted. If ZFormat is specified, then bits in all planes not specified in plane-mask transmitted as zero. The returned depth specifies the number of bits per pixel of the image. If the drawable is a window, its visual type is returned; if the drawable is a pixmap,the visual is None.

If the drawable is a window, the window must be mapped, and it must be the case that, if there were no inferiors or overlapping windows, the specified rectangle of the window would be fully visible on the screen will include any visible portions of inferiors or overlapping windows contained in the rectangle, but if these windows are of different depth than the specified window, the contents returned for them are not defined by the core protocol.

PolyText8​

drawable: DRAWABLE
gc: GCONTEXT
x, y: INT16
items: LISTofTEXTITEM8

where

TEXTITEM8: TEXTELT8 or FONT
TEXTELT8: [delta: INT8
string: STRING8]
Errors: Drawable, GContext, Match, Font

The x and y coordinates are relative to drawable's origin, and specify the baseline starting position (the initial character origin). Each text item is processed in turn. A font item causes the font to be stored in gc, and to be used for subsequent text; switching among fonts with differing draw-directions is permitted. A text element delta specifies an additional change in the position along the x axis before the string is drawn; the delta is always added to the character origin (not added or subtracted based on the draw-direction of the current font). Each character image, as defined by the a font in gc, is treated as an additional mask for a fill operation on the drawable.

All contained FONTs are always transmitted most significant byte first.

If a Font error is generated for an item, the previous items may have been drawn.

For fonts defined with two-byte matrix indexing, each STRING8 byte is interpreted as a byte2 value of a CHAR2B with a byte1 value of zero.

GC components: alu-function, plane-mask, fill-style, font, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask GC mode-dependent components: foreground, tile, stipple, tile-stipple-x-origin, tile-stipple-y-origin

PolyText16​

drawable: DRAWABLE
gc: GCONTEXT
x, y: INT16
items: LISTofTEXTITEM16

where

TEXTITEM16: TEXTELT16 or FONT
TEXTELT16: [delta-x: INT8
string: STRING16]
Errors: Drawable, GContext, Match, Font

Just like PolyText8, except two-byte (or 16-bit) characters are used. For fonts defined with linear indexing rather than two-byte matrix indexing, the server will interpret each CHAR2B as a 16-bit number that has been transmitted most significant byte first (i.e., byte1 of the CHAR2B is taken as the most significant byte).

ImageText8​

drawable: DRAWABLE
gc: GCONTEXT
x, y: INT16
string: STRING8
Errors: Drawable, GContext, Match

The x and y coordinates are relative to drawable's origin, and specify the baseline starting position (the initial character origin). The effect is to first fill a destination rectangle with the background pixel defined in gc, and then paint the text with the foreground pixel. The upper left corner of the filled rectangle is at

[x + overall-left, y - font-ascent]

the width is

overall-right - overall-left

and the height is

font-ascent + font-descent

where overall-left, overall-right, font-ascent, and as font-descent are would be returned by a QueryTextExtents call using gc and string.

The alu-function and fill-style defined in gc are ignored for this request; the effective alu-function is Copy and the effective fill-style Solid.

For fonts defined with two-byte matrix indexing, each STRING8 byte is interpreted as a byte2 value of a CHAR2B with a byte1 value of zero.

GC components: plane-mask, foreground, background, font, subwindow-mode, clip-x-origin, clip-y-origin, clip-mask

ImageText16​

drawable: DRAWABLE
gc: GCONTEXT
x, y: INT16
string: STRING16
Errors: Drawable, GContext, Match

Just like ImageText8, except two-byte (or 16-bit) characters are used. For fonts defined with linear indexing rather than two-byte matrix indexing, the server will interpret each CHAR2B as a 16-bit number that has been transmitted most significant byte first (i.e., byte1 of the CHAR2B is taken as the most significant byte).