Inherited by FreeCanvas, PaintCanvas, and UpdateCanvas.
Public Member Functions | |
int | drawText (const SmartUtil::tstring &text, const SmartWin::Rectangle &rect, unsigned format) |
Draws given string within given Rectangle. | |
void | ellipse (const SmartWin::Rectangle &rect) |
Draws an ellipse in the Device Context. | |
void | ellipse (int left, int top, int right, int bottom) |
Draws an ellipse in the Device Context. | |
bool | extFloodFill (int x, int y, COLORREF color, bool fillTilColorFound) |
parameter. | |
void | extTextOut (const SmartUtil::tstring &text, unsigned x, unsigned y) |
Draws given text inside given Rectangle. | |
void | fillRectangle (const SmartWin::Rectangle &rect, Brush &brush) |
Fills a Rectangle in the Device Context with the given brush. | |
void | fillRectangle (int left, int top, int right, int bottom, Brush &brush) |
Fills a Rectangle in the Device Context with the given brush. | |
COLORREF | getBkColor () |
Gets the background color for the this Canvas. | |
HDC | getDc () |
Returns the Device Context for the Canvas. | |
int | getDeviceCaps (int nIndex) |
Gets the device capabilities. | |
COLORREF | getPixel (const Point &coord) |
Returns the pixel's color at given point. | |
COLORREF | getPixel (int x, int y) |
Returns the pixel's color at (x,y). | |
COLORREF | getSysColor (int index) |
Gets the color for an system display object. | |
void | line (const SmartWin::Rectangle &rect) |
Draws a line around a Rectangle without filling it. | |
void | line (const Point &start, const Point &end) |
Draws a line from Start to End in the Device Context. | |
void | line (int xStart, int yStart, int xEnd, int yEnd) |
Draws a line in the Device Context. | |
void | lineTo (const Point &coord) |
Draws a line from the current position to a specific Point. | |
void | lineTo (int x, int y) |
Draws a line from the current position to a X,Y point. | |
void | moveTo (const Point &coord) |
Moves to a specific Point. (But does not draw). | |
void | moveTo (int x, int y) |
Moves to a X,Y point. (But does not draw). | |
void | polygon (POINT points[], unsigned count) |
Fills a polygon defined by vertices. | |
void | polygon (const Point points[], unsigned count) |
Fills a polygon defined by vertices. | |
void | rectangle (const SmartWin::Rectangle &rect) |
Draws a Rectangle in the Device Context. | |
void | rectangle (int left, int top, int right, int bottom) |
Draws a Rectangle in the Device Context. | |
void | selectFont (FontPtr font) |
Selects the given font. | |
COLORREF | setBkColor (COLORREF crColor) |
Sets the background color for the this Canvas. | |
bool | setBkMode (bool transparent=false) |
Sets the background mode. | |
COLORREF | setPixel (int x, int y, COLORREF pixcolor) |
Sets the pixel at (x,y) to be pixcolor. Returns the old pixel color. | |
unsigned | setTextAlign (unsigned fMode) |
Sets the alignment mode for text operations. | |
COLORREF | setTextColor (COLORREF crColor) |
Sets the TextColor of the this Canvas. | |
Protected Member Functions | |
Canvas (Widget *widget) | |
Not meant for directly instantiation. | |
Canvas (HWND hWnd) | |
Not meant for directly instantiation. | |
virtual | ~Canvas () |
Protected Constructor to prevent deletion of class directly. | |
Protected Attributes | |
HWND | itsHandle |
Handle to the window of the object. | |
HDC | itsHdc |
Handle to the Device Context of the object. |
Helper class containing functions for drawing lines and objects inside a window.
Not meant to be directly instantiated, but rather instantiated through e.g. the PaintCanvas or UpdateCanvas classes.
Related classes
Canvas | ( | HWND | hWnd | ) | [explicit, protected] |
Not meant for directly instantiation.
Class basically serves as an "abstract" base class for PaintCanvas and UpdateCanvas.
You should not directly instantiate this class but instead use one of the derived classes.
Not meant for directly instantiation.
Class basically serves as an "abstract" base class for PaintCanvas and UpdateCanvas.
You should not directly instantiate this class but instead use one of the derived classes.
virtual ~Canvas | ( | ) | [protected, virtual] |
Protected Constructor to prevent deletion of class directly.
Derived class should delete, basically a hack to prevent deletion of a base class pointer
int drawText | ( | const SmartUtil::tstring & | text, | |
const SmartWin::Rectangle & | rect, | |||
unsigned | format | |||
) |
Draws given string within given Rectangle.
Draw text within a rectangle according to given format.
The format can be any combination of:
void ellipse | ( | const SmartWin::Rectangle & | rect | ) |
Draws an ellipse in the Device Context.
Draws an ellipse within the given rectangle.
void ellipse | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom | |||
) |
Draws an ellipse in the Device Context.
Draws an ellipse from (left, top) to (right, bottom).
bool extFloodFill | ( | int | x, | |
int | y, | |||
COLORREF | color, | |||
bool | fillTilColorFound | |||
) |
parameter.
If fillTilColorFound is true filling continues outwards from (x,y) until we find the given color and stops there.
If it is false it will fill AS LONG as it finds the given color and stop when it finds another color.
Function returns true if any filling was done, if no filling was done at all it'll return false.
void extTextOut | ( | const SmartUtil::tstring & | text, | |
unsigned | x, | |||
unsigned | y | |||
) |
void fillRectangle | ( | const SmartWin::Rectangle & | rect, | |
Brush & | brush | |||
) |
void fillRectangle | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom, | |||
Brush & | brush | |||
) |
COLORREF getBkColor | ( | ) |
Gets the background color for the this Canvas.
Gets the background color for extTextOut() calls. Returns the current background color.
HDC getDc | ( | ) |
Returns the Device Context for the Canvas.
Can be used to construct e.g. a Pen object or a HdcModeSetter object
int getDeviceCaps | ( | int | nIndex | ) |
Gets the device capabilities.
HORZRES, VERTRES give pixels
COLORREF getPixel | ( | const Point & | coord | ) |
Returns the pixel's color at given point.
Returns the pixel's color at coord in the Device Context of the object.
COLORREF getPixel | ( | int | x, | |
int | y | |||
) |
Returns the pixel's color at (x,y).
Returns the pixel's color at (x,y) in the Device Context of the object.
COLORREF getSysColor | ( | int | index | ) |
Gets the color for an system display object.
Example: getSysColor( COLOR_WINDOW )
void line | ( | const SmartWin::Rectangle & | rect | ) |
Draws a line from Start to End in the Device Context.
Draws a line from Start to End.
An alternate for line( int xStart, int yStart, int xEnd, int yEnd )
void line | ( | int | xStart, | |
int | yStart, | |||
int | xEnd, | |||
int | yEnd | |||
) |
Draws a line in the Device Context.
Draws a line from (xStart, yStart) to (xEnd, yEnd).
void lineTo | ( | const Point & | coord | ) |
void lineTo | ( | int | x, | |
int | y | |||
) |
Draws a line from the current position to a X,Y point.
Draws to x,y in the Device Context of the object. Use line (below) if you know two coordinates.
void moveTo | ( | const Point & | coord | ) |
void moveTo | ( | int | x, | |
int | y | |||
) |
Moves to a X,Y point. (But does not draw).
Moves to x,y in the Device Context of the object.
void polygon | ( | POINT | points[], | |
unsigned | count | |||
) |
Fills a polygon defined by vertices.
Fills a polygon defined by vertices.
void polygon | ( | const Point | points[], | |
unsigned | count | |||
) |
Fills a polygon defined by vertices.
Fills a polygon defined by vertices.
void rectangle | ( | const SmartWin::Rectangle & | rect | ) |
void rectangle | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom | |||
) |
void selectFont | ( | FontPtr | font | ) |
Selects the given font.
Selects the given font for later text operations
COLORREF setBkColor | ( | COLORREF | crColor | ) |
Sets the background color for the this Canvas.
Sets the background color for extTextOut() calls. Returns the previous background color
bool setBkMode | ( | bool | transparent = false |
) |
Sets the background mode.
Can either be transparent (true) or opaque (false). Returns true if the previous background mode was transparent, false if it was opaque
COLORREF setPixel | ( | int | x, | |
int | y, | |||
COLORREF | pixcolor | |||
) |
Sets the pixel at (x,y) to be pixcolor. Returns the old pixel color.
Sets the pixel at (x,y) to be pixcol
unsigned setTextAlign | ( | unsigned | fMode | ) |
Sets the alignment mode for text operations.
Returns the previous alignement mode and changes the current mode of text operations. Possible values can be any combination of these:
COLORREF setTextColor | ( | COLORREF | crColor | ) |
Sets the TextColor of the this Canvas.
Sets the TextColor for future TextOut() calls. Returns the previous color.
HWND itsHandle [protected] |
Handle to the window of the object.
Handle of the window that the Canvas is for
HDC itsHdc [protected] |
Handle to the Device Context of the object.
Derived classes needs access to this to e.g. call BeginPaint and EndPaint