class::draw::Drawing

class draw::Drawing
  : public api::DrawWorkObject

This is the base class for creating drawings. A Drawing class allows for nesting and positioning of graphics within a bitmap.

void MyObject::draw(const DrawingAttributes::attr){
   Icon my_icon;
   drawing_area_t square;

   square = attr.square_w(500);

   //this will draw my icon centered in the bitmap specified by attr
   //adding drawing_point(250, 250) offset the icon by 25% of the bitmap in both x and y
   //adding a drawing_area_t will then scale icon to fit in a square that is half the width of the bitmap (see square_width())
   //draw will call the underlying draw_to_scale() method unless Icon re-implements draw
   my_icon.draw(attr + DrawingPoint(250, 250) + square);

}

Members

Drawing()
sg_color_t color()
bool dark() const
sg_color_t default_color()
virtual void draw(

const DrawingAttributes & attr
)

void draw(

sgfx::Bitmap & b,
drawing_int_t x,
drawing_int_t y,
drawing_size_t w,
drawing_size_t h
)

virtual void draw_scratch(

const DrawingAttributes & attr
)

virtual void draw_to_scale(

const DrawingScaledAttr & attr
)

void draw_to_scale(

sgfx::Bitmap & b,
sg_int_t x,
sg_int_t y,
sg_size_t w,
sg_size_t h
)

bool invert() const
bool is_align_bottom() const
bool is_align_center() const
bool is_align_left() const
bool is_align_middle() const
bool is_align_right() const
bool is_align_top() const
bool is_visible() const
void set_align_bottom(

bool v
)

void set_align_center(

bool v
)

void set_align_left(

bool v
)

void set_align_middle(

bool v
)

void set_align_right(

bool v
)

void set_align_top(

bool v
)

void set_color(

sg_color_t value
)

void set_dark(

bool v
)

void set_default_color(

sg_color_t value
)

void set_invert(

bool v
)

void set_visible(

bool v
)

static void clear(

const DrawingAttributes & attr,
sg_bmap_data_t v
)

static void draw_checkerboard(

const DrawingAttributes & attr,
sg_size_t pattern_height
)

static void draw_pattern(

const DrawingAttributes & attr,
sg_bmap_data_t odd_pattern,
sg_bmap_data_t even_pattern,
sg_size_t pattern_height
)

static sg_size_t h(

sg_size_t scale,
sg_area_t d
)

static sg_size_t height(

sg_size_t scale,
sg_area_t d
)

static void invert(

const DrawingAttributes & attr,
sg_bmap_data_t v
)

static void set(

const DrawingAttributes & attr,
sg_color_t color
)

static void set_scale(

drawing_size_t s
)

static sg_size_t w(

sg_size_t scale,
sg_area_t d
)

static sg_size_t width(

sg_size_t scale,
sg_area_t d
)

Details

Drawing()

sg_color_t color()

bool dark() const

sg_color_t default_color()

virtual void draw(

const DrawingAttributes & attr
)

This method draws the object using the specified drawing attributes.

The attributes specify which bitmap to draw on, what size to draw, and where to draw. The dimensions and position are scaled to fit on the bitmap.


void draw(

sgfx::Bitmap & b,
drawing_int_t x,
drawing_int_t y,
drawing_size_t w,
drawing_size_t h
)


virtual void draw_scratch(

const DrawingAttributes & attr
)


virtual void draw_to_scale(

const DrawingScaledAttr & attr
)

This methods draws the drawing on the specified attributes.

Parameters

  • attr Specifies the bitmap, point and area to draw the drawing

void draw_to_scale(

sgfx::Bitmap & b,
sg_int_t x,
sg_int_t y,
sg_size_t w,
sg_size_t h
)


bool invert() const

bool is_align_bottom() const

bool is_align_center() const

bool is_align_left() const

bool is_align_middle() const

bool is_align_right() const

bool is_align_top() const

bool is_visible() const

void set_align_bottom(

bool v
)


void set_align_center(

bool v
)


void set_align_left(

bool v
)


void set_align_middle(

bool v
)


void set_align_right(

bool v
)


void set_align_top(

bool v
)


void set_color(

sg_color_t value
)


void set_dark(

bool v
)


void set_default_color(

sg_color_t value
)


void set_invert(

bool v
)


void set_visible(

bool v
)


static void clear(

const DrawingAttributes & attr,
sg_bmap_data_t v
)

This method will clear the pixels in the area of the bitmap specified.

Parameters

  • attr Specifies the bitmap and area

  • v Specifies the fill pattern


static void draw_checkerboard(

const DrawingAttributes & attr,
sg_size_t pattern_height
)


static void draw_pattern(

const DrawingAttributes & attr,
sg_bmap_data_t odd_pattern,
sg_bmap_data_t even_pattern,
sg_size_t pattern_height
)


static sg_size_t h(

sg_size_t scale,
sg_area_t d
)


static sg_size_t height(

sg_size_t scale,
sg_area_t d
)


static void invert(

const DrawingAttributes & attr,
sg_bmap_data_t v
)

This method will invert the pixels in the area of the bitmap specified.

Parameters

  • attr Specifies the bitmap and area

  • v Specifies the fill pattern


static void set(

const DrawingAttributes & attr,
sg_color_t color
)

This method will set the pixels in the area of the bitmap specified.

Parameters

  • attr Specifies the bitmap and area

  • color Specifies the fill pattern


static void set_scale(

drawing_size_t s
)


static sg_size_t w(

sg_size_t scale,
sg_area_t d
)


static sg_size_t width(

sg_size_t scale,
sg_area_t d
)


X

Thanks for Coming!

Subscribe to news and updates