## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iPen Struct Reference

A pen is used to draw vector shapes. More...

`#include <cstool/pen.h>`

Inheritance diagram for iPen:

[legend]
List of all members.

## Public Member Functions

virtual void | ClearFlag (uint flag)=0
| Clears the given flag.
virtual void | ClearTransform ()=0
| Clears the current transform, resets to identity.
virtual void | DrawArc (uint x1, uint y1, uint x2, uint y2, float start_angle, float end_angle)=0
| Draws an elliptical arc from start angle to end angle.
virtual void | DrawLine (uint x1, uint y1, uint x2, uint y2)=0
| Draws a single line.
virtual void | DrawMiteredRect (uint x1, uint y1, uint x2, uint y2, uint miter)=0
| Draws a mitered rectangle.
virtual void | DrawPoint (uint x1, uint y2)=0
| Draws a single point.
virtual void | DrawRect (uint x1, uint y1, uint x2, uint y2)=0
| Draws a rectangle.
virtual void | DrawRoundedRect (uint x1, uint y1, uint x2, uint y2, uint roundness)=0
| Draws a rounded rectangle.
virtual void | DrawTriangle (uint x1, uint y1, uint x2, uint y2, uint x3, uint y3)=0
| Draws a triangle around the given vertices.
virtual void | PopTransform ()=0
| Pops the transform stack.
virtual void | PushTransform ()=0
| Pushes the current transform onto the stack.
virtual void | Rotate (const float &a)=0
| Rotates by the given angle.
virtual void | SetColor (const csColor4 &color)=0
| Sets the current color.
virtual void | SetColor (float r, float g, float b, float a)=0
| Sets the current color.
virtual void | SetFlag (uint flag)=0
| Sets the given flag.
virtual void | SetMixMode (uint mode)=0
| Sets the given mix (blending) mode.
virtual void | SetOrigin (const csVector3 &o)=0
| Sets the origin of the coordinate system.
virtual void | SetPenWidth (float width)=0
| Sets the width of the pen for line drawing.
virtual void | SetTexture (csRef< iTextureHandle > tex)=0
| Sets the texture handle.
virtual void | SwapColors ()=0
| Swaps the current color and the alternate color.
virtual void | Translate (const csVector3 &t)=0
| Translates by the given vector.
virtual void | Write (iFont *font, uint x1, uint y1, char *text)=0
| Writes text in the given font at the given location.
virtual void | WriteBoxed (iFont *font, uint x1, uint y1, uint x2, uint y2, uint h_align, uint v_align, char *text)=0
| Writes text in the given font, in the given box.

## Protected Member Functions

virtual | ~iPen ()

## Detailed Description

A pen is used to draw vector shapes.

Definition at line 64 of file pen.h.

## Member Function Documentation

virtual void iPen::ClearFlag | ( | uint | flag | ) | `[pure virtual]`

Clears the given flag.

Parameters:

  | flag | The flag to clear.

Implemented in csPen, and csMemoryPen.

virtual void iPen::ClearTransform | ( |  | ) | `[pure virtual]`

Clears the current transform, resets to identity.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawArc | ( | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2,
|  | float | start_angle,
|  | float | end_angle |
| ) |  |  | `[pure virtual]`

Draws an elliptical arc from start angle to end angle.

Angle must be specified in radians. The arc will be made to fit in the given box. If you want a circular arc, make sure the box is a square. If you want a full circle or ellipse, specify 0 as the start angle and 2*PI as the end angle.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawLine | ( | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2 |
| ) |  |  | `[pure virtual]`

Draws a single line.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawMiteredRect | ( | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2,
|  | uint | miter |
| ) |  |  | `[pure virtual]`

Draws a mitered rectangle.

The miter value should be between 0.0 and 1.0, and determines how much of the corner is mitered off and beveled.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawPoint | ( | uint | x1,
|  | uint | y2 |
| ) |  |  | `[pure virtual]`

Draws a single point.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawRect | ( | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2 |
| ) |  |  | `[pure virtual]`

Draws a rectangle.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawRoundedRect | ( | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2,
|  | uint | roundness |
| ) |  |  | `[pure virtual]`

Draws a rounded rectangle.

The roundness value should be between 0.0 and 1.0, and determines how much of the corner is rounded off.

Implemented in csPen, and csMemoryPen.

virtual void iPen::DrawTriangle | ( | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2,
|  | uint | x3,
|  | uint | y3 |
| ) |  |  | `[pure virtual]`

Draws a triangle around the given vertices.

Implemented in csPen, and csMemoryPen.

virtual void iPen::PopTransform | ( |  | ) | `[pure virtual]`

Pops the transform stack.

The top of the stack becomes the current transform.

Implemented in csPen, and csMemoryPen.

virtual void iPen::PushTransform | ( |  | ) | `[pure virtual]`

Pushes the current transform onto the stack.

*

Implemented in csPen, and csMemoryPen.

virtual void iPen::Rotate | ( | const float & | a | ) | `[pure virtual]`

Rotates by the given angle.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetColor | ( | const csColor4 & | color | ) | `[pure virtual]`

Sets the current color.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetColor | ( | float | r,
|  | float | g,
|  | float | b,
|  | float | a |
| ) |  |  | `[pure virtual]`

Sets the current color.

Parameters:

  | r | The red component.
  | g | The green component.
  | b | The blue component.
  | a | The alpha component.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetFlag | ( | uint | flag | ) | `[pure virtual]`

Sets the given flag.

Parameters:

  | flag | The flag to set.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetMixMode | ( | uint | mode | ) | `[pure virtual]`

Sets the given mix (blending) mode.

Parameters:

  | mode | The mixmode to set.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetOrigin | ( | const csVector3 & | o | ) | `[pure virtual]`

Sets the origin of the coordinate system.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetPenWidth | ( | float | width | ) | `[pure virtual]`

Sets the width of the pen for line drawing.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SetTexture | ( | csRef< iTextureHandle > | tex | ) | `[pure virtual]`

Sets the texture handle.

Parameters:

  | tex | A reference to the texture to use.

Implemented in csPen, and csMemoryPen.

virtual void iPen::SwapColors | ( |  | ) | `[pure virtual]`

Swaps the current color and the alternate color.

Implemented in csPen, and csMemoryPen.

virtual void iPen::Translate | ( | const csVector3 & | t | ) | `[pure virtual]`

Translates by the given vector.

Implemented in csPen, and csMemoryPen.

virtual void iPen::Write | ( | iFont * | font,
|  | uint | x1,
|  | uint | y1,
|  | char * | text |
| ) |  |  | `[pure virtual]`

Writes text in the given font at the given location.

Implemented in csPen, and csMemoryPen.

virtual void iPen::WriteBoxed | ( | iFont * | font,
|  | uint | x1,
|  | uint | y1,
|  | uint | x2,
|  | uint | y2,
|  | uint | h_align,
|  | uint | v_align,
|  | char * | text |
| ) |  |  | `[pure virtual]`

Writes text in the given font, in the given box.

The alignment specified in h_align and v_align determine how it should be aligned.

Implemented in csPen, and csMemoryPen.

The documentation for this struct was generated from the following file:

- cstool/pen.h