Next: , Previous: , Up: Graphic Operations   [Contents][Index]


7.5 Drawing Arcs

draw-arc draws a single circular or an elliptical arc, while draw-arcs draws multiple circular or elliptical arcs. draw-arc and draw-arcs use the following graphics context components: arc-mode, background, cap-style, clip-x, clip-y, clip-mask, dash-list, dash-offset, fill-style, foreground, join-style, function, plane-mask, line-width, line-style, stipple, subwindow-mode, tile, ts-x-origin, and ts-y-origin.

Function: draw-arc drawable gcontext x y width height angle1 angle2 &optional fill-p
drawable

The destination drawable.

gcontext

The graphics context for drawing the arc.

x
y

The x and y coordinates of the arc rectangle relative to the origin of the drawable. Type is int16.

width
height

Specifies the width and height of the rectangle. These are the major and minor axes of the arc. Type is card16.

angle1

Specifies the start of the arc in radians. Type is angle.

angle2

Specifies the direction and end point of the arc. Type is angle.

fill-p

Specifies whether the arc is filled or not. Type boolean.

Draws either a circular or an elliptical arc. Also, outlined or filled arcs can be drawn. Each arc is specified by a rectangle (x, y, width, and height) and two angles (angle1 and angle2). The angles are signed integers in radians, with positive indicating counterclockwise motion and negative indicating clockwise motion. The start of the arc is specified by angle1, 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 x and y coordinates of the rectangle are relative to the drawable’s origin.

For example, an arc specified as [x,y,width,height,angle1,angle2] has the origin of the major and minor axes at:

[x+(width/2),y+(height/2)]

The infinitely thin path describing the entire circle/ellipse intersects the horizontal axis at:

[x,y+(height/2)] and [x+width,y+(height/2)]

The intersection of the vertical axis is at:

[x+(width/2),y] and [x+(width/2),y+height]

These coordinates can be fractional; that is, they are not truncated to discrete coordinates. Note that the angle values are slightly different in CLX than in the X protocol specification.

If fill-p is nil, then only the outline of the arc is drawn. Otherwise, if fill-p is true, draw-arc fills the area bounded by the arc outline and one or two line segments, depending on the arc-mode. If the arc-mode is :chord, the filled area is bounded by the arc outline and the line segment joining the arc end points. If the arc-mode is :pie-slice, the filled area is bounded by the arc outline and the two line segments joining each arc end point with the center point.

Function: draw-arcs drawable gcontext arcs &optional fill-p
drawable

Specifies the drawable where you want the arcs drawn.

gcontext

Specifies the graphics context for drawing the arc.

arcs

A sequence containing the width, height, angle1, and angle2 arguments defining the arcs. See draw-arc for more detail. Type is arc-seq.

fill-p

Specifies whether the arcs are filled or not. Type is boolean.

Draws circular or elliptical, outlined or filled arcs. Each arc is specified by a rectangle and two angles. For a more detailed description, see draw-arc.

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.


Next: , Previous: , Up: Graphic Operations   [Contents][Index]