class::sgfx::Pen

class sgfx::Pen
  : public api::SgfxInfoObject

The pen defines the color, thickness and mode when drawing on bitmaps.

Whenever drawing on bitmaps, a pen is associated with the bitmap. The current state of the pen determines how primitives are drawn.

First, pens have a color value that is represented by the number of bits linked to the graphics library. For example, when using 1bpp, valid colors values are 0 and 1.

Pens can operate in four modes:

  • Solid: pen color is assigned to bitmap
  • Blend: pen color is OR’d with bitmap color
  • Invert: pen color is XOR’d with bitmap color
  • Erase: pen color is inverted when AND’d with the bitmap color

When drawing a source bitmap on a destination bitmap, the pen mode is determined by the destination bitmap’s pen. The pen color is ignored and the source bitmap pixel color is used. The source bitmap’s pen is not used in bitmap to bitmap drawing operations.

Icon vector graphics sometimes include fill points. The destination bitmap’s pen determines whether or not the fill operations are performed based on the pen’s fill flag (see is_fill() and set_fill()).

The pen can also specify a thickness which applies to drawing lines and arcs on bitmaps.

Summary

Pen()

Pen(

sg_color_t color
)

Pen(

sg_color_t color,
u8 thickness,
bool fill
)

Pen(

sg_color_t color,
u16 o_flags
)

[Pen](#classsgfx_1_1_pen_1a042d57205f90b1a96332ede20637fa6f)(  

const sg_pen_t & pen
)

sg_color_t color() const

u16 flags() const

bool is_blend() const

bool is_erase() const

bool is_fill() const

bool is_invert() const

bool is_solid() const

u16 o_flags() const

[operator const sg_pen_t &](#classsgfx_1_1_pen_1aac87c738c3d81f9cdcc0da99bb42ce83)() *const*

const sg_pen_t & pen() const

sg_pen_t & pen()

Pen & set_blend()

Pen & set_color(

sg_color_t color
)

Pen & set_erase()

Pen & set_fill(

bool v
)

Pen & set_flags(

u16 flags
)

Pen & set_invert()

Pen & set_solid()

Pen & set_thickness(

u8 v
)

u8 thickness() const

enum @11

Members

Pen()

Pen(

sg_color_t color
)


Pen(

sg_color_t color,
u8 thickness,
bool fill
)


Pen(

sg_color_t color,
u16 o_flags
)


Pen(

const sg_pen_t & pen
)


sg_color_t color() const

Access the pen color.


u16 flags() const

bool is_blend() const

Returns true if pen is in blend mode.


bool is_erase() const

Returns true if pen is in erase mode.


bool is_fill() const

Returns true if fill is enabled for pen (used with icons).


bool is_invert() const

Returns true if pen is in invert mode.


bool is_solid() const

u16 o_flags() const

operator const sg_pen_t &() const

const sg_pen_t & pen() const

sg_pen_t & pen()

Pen & set_blend()

Sets the pen to a blending mode (OR).


Pen & set_color(

sg_color_t color
)

Sets the pen color.

Parameters

  • color The color

Pen & set_erase()

Sets the pen to a clearing mode (AND).


Pen & set_fill(

bool v
)

Sets the pen to fill when drawing vector icons.


Pen & set_flags(

u16 flags
)


Pen & set_invert()

Sets the pen to inverting color mode (XOR).


Pen & set_solid()

Sets the pen to a solid color mode (assign value).


Pen & set_thickness(

u8 v
)

Sets the pen thickness.


u8 thickness() const

Accesses the pen thickness.


enum @11
  • IS_SOLID Draw solid
  • IS_INVERT Draw Invert (XOR)
  • IS_BLEND Draw Blend (OR)
  • IS_ERASE Draw Erase (NOT AND)
  • IS_FILL Draw Icon with fill points

X

Thanks for Coming!

Subscribe to news and updates