Inherits Canvas.
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. | |
FreeCanvas (Widget *widget, HDC hdc) | |
Constructor, assigns the given HDC to the object. | |
FreeCanvas (HWND hWnd, HDC hdc) | |
Constructor, assigns given HWND and HDC to object. | |
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 Attributes | |
HWND | itsHandle |
Handle to the window of the object. | |
HDC | itsHdc |
Handle to the Device Context of the object. |
Note this class does NOT create or instantiate a HDC like the PaintCanvas and the UpdateCanvas. It assumes that the given HDC is already valid and instantiated. If you need to paint or update a Widget and you don't have a valid HDC use the UpdateCanvas or within a onPainting event handler use the PaintCanvas. Related classes
FreeCanvas | ( | HWND | hWnd, | |
HDC | hdc | |||
) |
Constructor, assigns given HWND and HDC to object.
Takes the handle to the window we're supposed to paint.
FreeCanvas | ( | Widget * | widget, | |
HDC | hdc | |||
) |
Constructor, assigns the given HDC to the object.
Takes a pointer to the Widget we're supposed to paint.
int drawText | ( | const SmartUtil::tstring & | text, | |
const SmartWin::Rectangle & | rect, | |||
unsigned | format | |||
) | [inherited] |
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 | ) | [inherited] |
Draws an ellipse in the Device Context.
Draws an ellipse within the given rectangle.
void ellipse | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom | |||
) | [inherited] |
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 | |||
) | [inherited] |
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 | |||
) | [inherited] |
void fillRectangle | ( | const SmartWin::Rectangle & | rect, | |
Brush & | brush | |||
) | [inherited] |
void fillRectangle | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom, | |||
Brush & | brush | |||
) | [inherited] |
COLORREF getBkColor | ( | ) | [inherited] |
Gets the background color for the this Canvas.
Gets the background color for extTextOut() calls. Returns the current background color.
HDC getDc | ( | ) | [inherited] |
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 | ) | [inherited] |
Gets the device capabilities.
HORZRES, VERTRES give pixels
COLORREF getPixel | ( | const Point & | coord | ) | [inherited] |
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 | |||
) | [inherited] |
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 | ) | [inherited] |
Gets the color for an system display object.
Example: getSysColor( COLOR_WINDOW )
void line | ( | const SmartWin::Rectangle & | rect | ) | [inherited] |
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 | |||
) | [inherited] |
Draws a line in the Device Context.
Draws a line from (xStart, yStart) to (xEnd, yEnd).
void lineTo | ( | const Point & | coord | ) | [inherited] |
void lineTo | ( | int | x, | |
int | y | |||
) | [inherited] |
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 | ) | [inherited] |
void moveTo | ( | int | x, | |
int | y | |||
) | [inherited] |
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 | |||
) | [inherited] |
Fills a polygon defined by vertices.
Fills a polygon defined by vertices.
void polygon | ( | const Point | points[], | |
unsigned | count | |||
) | [inherited] |
Fills a polygon defined by vertices.
Fills a polygon defined by vertices.
void rectangle | ( | const SmartWin::Rectangle & | rect | ) | [inherited] |
void rectangle | ( | int | left, | |
int | top, | |||
int | right, | |||
int | bottom | |||
) | [inherited] |
void selectFont | ( | FontPtr | font | ) | [inherited] |
Selects the given font.
Selects the given font for later text operations
COLORREF setBkColor | ( | COLORREF | crColor | ) | [inherited] |
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 |
) | [inherited] |
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 | |||
) | [inherited] |
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 | ) | [inherited] |
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 | ) | [inherited] |
Sets the TextColor of the this Canvas.
Sets the TextColor for future TextOut() calls. Returns the previous color.
HWND itsHandle [protected, inherited] |
Handle to the window of the object.
Handle of the window that the Canvas is for
HDC itsHdc [protected, inherited] |
Handle to the Device Context of the object.
Derived classes needs access to this to e.g. call BeginPaint and EndPaint