Drawable_t Class Reference

Drawable object, which can be the target of drawing operations. More...

#include <UTDrawable.h>

Inheritance diagram for Drawable_t:
View_t Button_t LayoutView_t

List of all members.

Public Member Functions

 Drawable_t ()
virtual ~Drawable_t ()
virtual void SetBrush (const Color_t &color, float brush_width=1, line_cap_type_t cap_type=eLCT_butt_extended_half_width)
const Color_tBrushColor () const
float BrushWidth () const
line_cap_type_t BrushLineCapType () const
virtual void SetFillColor (const Color_t &color)
const Color_tFillColor () const
virtual void DrawLine (const Point_t &from, const Point_t &to, bool anti_alias=true)=0
virtual void DrawRect (const Rect_t &rect, bool anti_alias=true, bool fill=false)=0
virtual void DrawText (const String_t &string, const Point_t &where, bool anti_alias=true)=0
void SetFont (const Font_t &font)
const Font_tFont (bool create_new_if_null=false) const

Detailed Description

Non-core library: UTgfx

Drawable object, which can be the target of drawing operations under conditions limited by the actual subclass. For example, a View_t is a Drawable_t subclass, and drawing operations can only be performed from inside View_t::Paint.

The value space is that which is typically used is that for a monitor, with increasing x values to the right and increasing y values to the bottom. Floating point numbers are used by the UTgfx and UTgui libraries to represent screen display because for scaling, use of floating point computation until final conversion to an integer coordinate is more efficient than use of integers when scaling. That way the same interface can be used to render to the display, printer, and so on. Floats are accurate to within c_dbl_abs_min_denominator out to about 4,000,000.

Definition at line 60 of file UTDrawable.h.


Constructor & Destructor Documentation

Drawable_t::Drawable_t (  ) 

Drawable object constructor.

virtual Drawable_t::~Drawable_t (  )  [virtual]

Drawable object destructor.


Member Function Documentation

virtual void Drawable_t::SetBrush ( const Color_t color,
float  brush_width = 1,
line_cap_type_t  cap_type = eLCT_butt_extended_half_width 
) [virtual]

Sets the brush to be used for subsequent drawing operations.

Reimplemented in View_t.

const Color_t & Drawable_t::BrushColor (  )  const [inline]

Returns the brush color.

Definition at line 172 of file UTDrawable.h.

float Drawable_t::BrushWidth (  )  const [inline]

Returns the brush width.

Definition at line 179 of file UTDrawable.h.

line_cap_type_t Drawable_t::BrushLineCapType (  )  const [inline]

Returns the brush line cap type.

Definition at line 186 of file UTDrawable.h.

virtual void Drawable_t::SetFillColor ( const Color_t color  )  [virtual]

Sets the color to be used when drawing a filled shape as opposed to just the outline of the shape. The outline is always drawn using the color specified by SetBrush.

Reimplemented in View_t.

const Color_t & Drawable_t::FillColor (  )  const [inline]

Returns the fill color.

Definition at line 193 of file UTDrawable.h.

virtual void Drawable_t::DrawLine ( const Point_t from,
const Point_t to,
bool  anti_alias = true 
) [pure virtual]

Draws a line from the specified point to the specified point. If anti_alias is true, the line will be drawn using anti-aliasing. If anti_alias is false and the brush width is odd, from and to will be rounded to the nearest pixel boundary. If anti_alias is false and the brush width is even, from and to will be rounded to the nearest half-pixel boundary.

Implemented in View_t.

virtual void Drawable_t::DrawRect ( const Rect_t rect,
bool  anti_alias = true,
bool  fill = false 
) [pure virtual]

Draws a rectangle. If fill is true, the rectangle is filled with the fill color specified by SetFillColor. If anti_alias is false and the brush width is odd, from and to will be rounded to the nearest pixel boundary. If anti_alias is false and the brush width is even, from and to will be rounded to the nearest half-pixel boundary.

Implemented in View_t.

virtual void Drawable_t::DrawText ( const String_t string,
const Point_t where,
bool  anti_alias = true 
) [pure virtual]

Draws the specified text at the specified point. The point is on the baseline, on the left side of the string. If the string is rendered right to left, it will be, and the end of the string will be aligned to where.x. Right-to-left text in the middle of a left-to-right string will be rendered in flipped form. If anti_alias is true, the string will be rendered using anti-aliasing.

Implemented in View_t.

void Drawable_t::SetFont ( const Font_t font  ) 

Sets the font to be used for rendering text. It might defer to another font for characters which it does not support.

Reimplemented in View_t.

const Font_t* Drawable_t::Font ( bool  create_new_if_null = false  )  const

Returns the font currently in use for rendering text. It might defer to another font for characters which it does not support. If no font has been set and create_new_if_null is false, returns NULL. Otherwise returns the current font, or if none has been set, creates a font object for the default font.


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

Generated on Tue Dec 14 22:35:06 2010 for UT library by  doxygen 1.6.1