[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

#### 4.19.4.6 Pen methods

The following table summarizes all of the drawing functions available via Pen.

`Clear()`

  Clears a pen. All previous drawing functions are removed.

`SetFlag(flag_const)`

  Sets one or more Pen.FLAG_XXXX constants.

`ClearFlag(flag_const)`

  Clears one or more Pen.FLAG_XXXX constants.

`SetMixMode(mixmod_const)`

  Sets the blending mode to the given Pen.MIX_XXXX constant.

`SetMixMode(mixmod_object)`

  Sets the blending mode to the given blending object.

`SetColor(r,g,b,a)`

  Sets the color of the pen to the value specified by r,g,b,a

`SetColor(color_object)`

  Sets the color of the pen to the value specified by the Color object.

`SetTexture(tex)`

  Sets the current texture to tex.

`SwapColors()`

  Swaps the current color with the alternate color. SetColor sets the current color, and drawing is always done in the current color. However, sometimes you want to swap between two colors frequently, and this provides an optimized way to do so.

`SetWidth(pen_width)`

  Sets the width of the stroke when drawing a stroked shape. This number is in pixels and may be fractional.

`PushTransform()`

  Pushes the current transformation onto the stack.

`PopTransform()`

  Pops the last saved transformation from the stack and makes it the current one.

`ClearTransform()`

  Clear all transformations. Sets the transformation matrix to the identity.

`SetOrigin(x,y,z)`

  Sets the origin for the transformation matrix. This helps with rotating objects around a certain point.

`Translate(x,y,z)`

  Translate the transformation matrix by x,y,z.

`Rotate(radians)`

  Rotate the transformation matrix by radians.

`DrawLine(xmin, ymin, xmax, ymax)`

  Draw a line from (xmin,ymin) to (xmax,ymax)

`DrawRect(xmin, ymin, xmax, ymax)`

  Draw a rectangle from (xmin,ymin) to (xmax,ymax)

`DrawMiteredRect(xmin, ymin, xmax, ymax, miter_in_pixels)`

  Draw a rectangle from (xmin,ymin) to (xmax,ymax), beveling the edges by miter_in_pixels. That is, the corners will be cut off at miter_in_pixels from each edge.

`DrawRoundedRect(xmin, ymin, xmax, ymax, roundness_in_pixels)`

  Draw a rectangle from (xmin,ymin) to (xmax,ymax), rounding the edges by roundness_in_pixels. That is, the corners will be cut off at roundness_in_pixels from each edge, and an arc will be drawn instead.

`DrawArc(xmin, ymin, xmax, ymax, start_angle, end_angle)`

  Draw an arc that fills the box specified the rectangle (xmin,ymin) to (xmax,ymax). The left and right edges will touch xmin and xmax, while the top and bottom edges will touch ymin and ymax. The arc will be drawn from start_angle to end_angle. To draw a circle, start_angle should be 0, and end angle should be slightly over PI*2.

`DrawTriangle(x1, y2, x2, y2, x3, y3)`

  Draw a triangle connecting those points. The points must be given in clockwise order if you want the triangle filled.

`Draw(pen)`

  Appends all of the draw operations performed on this pen, to the given pen.

`Render(texture)`

  Renders the pen to a texture. In this way you can essentially create procedural textures. If the texture has any contents, they will be cleared by this operation. If you want to draw multiple objects onto a texture, use the same pen, concatenate multiple pens into one pen, or use compositing.

`Write(font, x, y, text)`

  Write the text in the given font at coordinate x,y.

`WriteBoxed(font, xmin, ymin, xmax, ymax, horizontal_alignment, vertical_alignment, text)`

  Write the text in the given font inside the box (xmin,ymin) - (xmax,ymax). The text will be aligned to the box using the Pen.ALIGN_XXXX constants.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.