A class representing something that can be drawn into.
![]() | DrawStringOptions The text alignment options determine the manner in which the drawn text related to the position it is being drawn into. |
![]() | ~PCanvas () Destroy the canvas, freeing any resources held by the canvas. |
![]() | Compare ( const PObject & obj ) const Compare two canvas objects returning their relative rank. |
![]() | operator= ( const PCanvasState & state ) Set the state of the canvas from the canvas state object. |
![]() | GetFont () const Get the current physical font that is used by drawing operations. |
![]() | GetAvailableFonts () const Get the list of available fonts the canvas currently supports. |
![]() | Save () Save the state of the canvas on an internal stack. |
![]() | Restore () Restore the state of the canvas to the last one saved. |
![]() | SetCurrentPosition ( PORDINATE x, PORDINATE y ) Set the current position for line drawing operations. |
![]() | MoveCurrentPosition ( PORDINATE x, PORDINATE y ) Move the current position for line drawing operations relative to the previous current position. |
![]() | MoveCurrentPosition ( const PPoint & pos ) Move the current position for line drawing operations relative to the previous current position. |
![]() | GetCurrentPosition () const Get the current position for line drawing operations. |
![]() | DrawLine ( PORDINATE x, PORDINATE y ) Draw a line, using the current canvas state pen modes, colour etc, from the current "pen position" to the specified point. |
![]() | DrawLine ( const PPoint & pt ) Draw a line, using the current canvas state pen modes, colour etc, from the current "pen position" to the specified point. |
![]() | DrawLineRelative ( PORDINATE x, PORDINATE y ) Draw a line, using the current canvas state pen modes, colour etc, from the current "pen position" to the point offset from that position. |
![]() | DrawLine ( PORDINATE x1, PORDINATE y1, PORDINATE x2, PORDINATE y2 ) Draw a line, using the current canvas state pen modes, colour etc, from a source point to a destination point, note that this does not update the current position for line drawing. |
![]() | DrawRect ( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height ) Draw a rectangle, using the current canvas state pen modes, fill modes, colours etc. |
![]() | FillRect ( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height ) Fill a rectangle, using the current canvas state fill modes, colours etc. |
![]() | DrawFocusRect ( const PRect & rect ) Draw a system standard focus indication rectangle. |
![]() | DrawBevelledRect ( const PRect & rect, BOOL raised, BOOL deep ) Draw a bevelled "3D look" rectangle. |
![]() | DrawRoundRect ( const PRect & rect, PDIMENSION cornerWidth, PDIMENSION cornerHeight ) Draw a rectangle with rounded corners, using the current canvas state pen modes, fill modes, colours etc. |
![]() | DrawEllipse ( const PRect & rect ) Draw an ellipse that fits into the specified rectangle, using the current canvas state pen modes, fill modes, colours etc. |
![]() | DrawArc ( const PRect & rect, int startAngle, int endAngle ) Draw an arc, using the current canvas state pen modes, colours etc. |
![]() | DrawPie ( const PRect & rect, int startAngle, int endAngle ) Draw a pie segment, using the current canvas state pen modes, fill modes, colours etc. |
![]() | DrawChord ( const PRect & rect, int startAngle, int endAngle ) Draw a chord segment, using the current canvas state pen modes, fill modes, colours etc. |
![]() | DrawPolyLine ( const PPointArray & ptArray ) Draw a series of lines between each consecutive point in the array, using the current canvas state pen modes, colours etc. |
![]() | DrawPolygon ( const PPointArray & ptArray ) Draw a closed polygon where the array of points determine its vertices. |
![]() | DrawImgIcon ( PORDINATE x, PORDINATE y, const PImgIcon & icn ) Draw the specified pixel bitmap image icon at the specified position. |
![]() | DrawIcon ( PORDINATE x, PORDINATE y, const PIcon & icn ) Draw the specified pixel bitmap icon at the specified position. |
![]() | DrawPixels ( PORDINATE x, PORDINATE y, const PPixelImage & pix ) Draw the specified pixel bitmap image at the specified position. |
![]() | DrawPixels ( const PRect & rect, const PPixelImage & pix ) Draw the specified pixel bitmap image scaling it to fit the spcified destination rectangle. |
![]() | DrawPict ( PORDINATE x, PORDINATE y, const PPictImage & pic ) Draw the specified picture image at the specified position. |
![]() | DrawPict ( const PRect & rect, const PPictImage & pic ) Draw the specified picture image into the specified rectangle, scaling it to fit. |
![]() | DrawString ( PORDINATE x, PORDINATE y, const PString & str, int options = LeftAlign ) Draw a string at the specified location, using the current canvas text font, modes and colours. |
![]() | DrawString ( const PRect & rect, const PString & str, int options = LeftAlign ) Draw a string within the bounds of the rectangle, using the current canvas text font, modes and colours. |
![]() | MeasureString ( const PString & str ) Get the width and height of the string if it were to be drawn in the current font selected for the canvas. |
![]() | MeasureString (const PString & str, PDIMENSION width) Return the height of the string if drawn with word wrapping about the specified width. |
![]() | DrawTextLine ( PORDINATE x, PORDINATE y, const char * textChars, const PDIMENSION * charWidths, PINDEX len ) Draw a single line of text at the specified starting position. |
![]() | GetDrawingBounds () const Get the limits of the drawable area for this canvas. |
![]() | GetPhysicalBounds (BOOL inPixels = FALSE) const Get the physical size of the drawable area for this canvas in pixels or millimetersThis is dependent on the specific descendent of PCanvas. |
![]() | SetClipRegion ( const PRegion & rgn ) Set the clip region for the canvas. |
![]() | GetClipRegion () const Get the clip region for the canvas. |
![]() | SetClipRect ( const PRect & rect ) Set the bounding rectangle around the clip region for the canvas. |
![]() | GetClipRect () const Get the bounding rectangle around the clip region for the canvas. |
![]() | IsInClipRegion ( const PPoint & pt ) const Determine if the specified point or any part of the specified rectangle is inside the clip region, ie any drawing operation would not be inhibited due to clipping. |
![]() | FromPixelsDX ( PDIMENSION dx ) const Convert the specified parameter from pixels to the coordinate system for this canvas. |
![]() | ToPixelsDX ( PDIMENSION dx ) const Convert the specified parameter from the coordinate system for this canvas to pixels. |
![]() | FromPointsX ( PDIMENSION dx ) Convert the specified parameter from printers points (1/72 inch) to the coordinate system for this canvas. |
![]() | ToPointsX ( PDIMENSION dx ) Convert the specified parameter from the coordinate system for this canvas to printers points (1/72 inch). |
![]() | New functions for class |
![]() | State : public PObject, public PCanvasState Actual font used by the canvas derived from the font in the canvas state. |
![]() | realFont Device (usually screen) resolution for conversion functions |
![]() | Member variables |
Run Time Type functions
Comparison functions
I/O functions
Miscellaneous functions
A class representing something that can be drawn into. There are three main; destinations of drawing that descend from this class: an area of the screen in a PInteractor, a printer device or an off screen image.NOTE *********************************** On Some platforms, canvases are a limited resource. Do NOT create and leave them around for long periods. As soon as it is not required till the next user event, destroy it!
There are a set of system parameter available in the PApplication
object that determine the way a bevelled rectangle is drawn. These are
the colours for highlight and shadow and the standard width of a
border. A "deep" bevell is 2 standard border widths.
The arc is always part of an ellipse that would fit in the rectangle.
The start and end indicate how much of the arc is drawn. Thus drawing
from 0 to 360 degrees would result in a complete ellipse. The start and end points do not actually need to be on the ellipse
boundary. Conceptually, a vector from the centre of the ellipse out to
the boundary is drawn and this represents the starting and end of the
drawn arc.
The arc is always part of an ellipse that would fit in the rectangle.
The start and end indicate how much of the arc is drawn. Thus drawing
from 0 to 360 degrees would result in a complete ellipse. The start and end points do not actually need to be on the ellipse
boundary. Conceptually, a vector from the centre of the ellipse out to
the boundary is drawn and this represents the starting and end of the
drawn arc.
The arc is always part of an ellipse that would fit in the rectangle.
The start and end indicate how much of the arc is drawn. Thus drawing
from 0 to 360 degrees would result in a complete ellipse. The start and end points do not actually need to be on the ellipse
boundary. Conceptually, a vector from the centre of the ellipse out to
the boundary is drawn and this represents the starting and end of the
drawn arc.
Note that there should be at least 2 points in the array provided.
There is an implicit line between the first and last points in the
array to close the polygon. Note that there should be at least 2 points in the array provided.
If the image is black and white (1 bit per pixel) then white pixels are
actually in the fill foreground colour and the black pixels are in the
fill background colour.
If the image is black and white (1 bit per pixel) then white pixels are
actually in the fill foreground colour and the black pixels are in the
fill background colour.
If the image is black and white (1 bit per pixel) then white pixels are
actually in the fill foreground colour and the black pixels are in the
fill background colour.
If the image is black and white (1 bit per pixel) then white pixels are
actually in the fill foreground colour and the black pixels are in the
fill background colour.
A picture image is a platform dependent representation of a series of
drawing instructions. This is usually much smaller than a pixel image
but is not as portable.
A picture image is a platform dependent representation of a series of
drawing instructions. This is usually much smaller than a pixel image
but is not as portable.
This mode is only relevent when aligment is to a rectangle. When a
point is used this is the same as LeftAligned.
These modes are only relevent when aligment is to a rectangle. When a
point is used they are ignored.
These modes are only relevent when aligment is to a rectangle. When a
point is used they are ignored.
The options parameter determines the relationship between the text
string drawn and the location it is drawn at. The point is placed at
the position relative to the rectangle formed around the text (as
returned by MeasureText()). Thus: options = bottomAlign | centred would result in the text positioned such that the specified point is at
the bottom centre of the line of text. See DrawStringOptions for
more infromation. Note the Justified alignment is not relevent for this function and is
treated as LeftAlign.
The options parameter determines the relationship between the text
string drawn and the rectangle it is drawn in. The BaseLine alignment is not relevent for this function and is treated
as BottomAlign.
No checking for lines or word wrapping is performed by this function.
With charWidths = NULL, this is the fastest way to draw text on the
canvas.
An application can optimise drawing operations by verifying that the
operation would actually do something. This can save significant
processing time under some circumstances.
An application can optimise drawing operations by verifying that the
operation would actually do something. This can save significant
processing time under some circumstances.
An application can optimise drawing operations by verifying that the
operation would actually do something. This can save significant
processing time under some circumstances.
virtual ~PCanvas()
virtual Comparison Compare( const PObject & obj ) const
New functions for class
virtual PCanvasState& operator=( const PCanvasState & state )
const PRealFont& GetFont() const
virtual PFontFamilyList GetAvailableFonts() const
virtual void Save()
virtual void Restore()
virtual void SetCurrentPosition( PORDINATE x, PORDINATE y )
y - New y position for line drawing operationsvirtual void MoveCurrentPosition( PORDINATE x, PORDINATE y )
y - Y amount to offset the position for line drawing.virtual void MoveCurrentPosition( const PPoint & pos )
virtual PPoint GetCurrentPosition() const
virtual void DrawLine( PORDINATE x, PORDINATE y )
y - Y position to draw the line to.virtual void DrawLine( const PPoint & pt )
virtual void DrawLineRelative( PORDINATE x, PORDINATE y )
y - Y offset to draw the line to.virtual void DrawLine( PORDINATE x1, PORDINATE y1, PORDINATE x2, PORDINATE y2 )
y1 - Y position to start the line from.
x2 - X position to draw the line to.
y2 - Y position to draw the line to.void DrawRect( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height )
y - Y position of the top left corner of the rectangle to draw.
width - Width of the rectangle to draw.
height - Height of the rectangle to draw.void FillRect( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height )
y - Y position of the top left corner of the rectangle to draw.
width - Width of the rectangle to draw.
height - Height of the rectangle to draw.virtual void DrawFocusRect( const PRect & rect )
virtual void DrawBevelledRect( const PRect & rect, BOOL raised, BOOL deep )
raised - Indicate that the rectangle looks raised or sunk.
deep - Indicate that rectangle looks deep or shallow.virtual void DrawRoundRect( const PRect & rect, PDIMENSION cornerWidth, PDIMENSION cornerHeight )
cornerWidth - The width of the rounded corners.
cornerHeight - The height of the rounded corners.virtual void DrawEllipse( const PRect & rect )
virtual void DrawArc( const PRect & rect, int startAngle, int endAngle )
startAngle - The angle in degrees to start drawing the arc.
endAngle - The angle in degrees to finish drawing the arc.virtual void DrawPie( const PRect & rect, int startAngle, int endAngle )
startAngle - The angle in degrees to start drawing the pie.
endAngle - The angle in degrees to finish drawing the pie.virtual void DrawChord( const PRect & rect, int startAngle, int endAngle )
startAngle - The angle in degrees to start drawing the chord.
endAngle - The angle in degrees to finish drawing the chord.virtual void DrawPolyLine( const PPointArray & ptArray )
virtual void DrawPolygon( const PPointArray & ptArray )
virtual void DrawImgIcon( PORDINATE x, PORDINATE y, const PImgIcon & icn )
y - The Y position at which to draw the image icon.
icn - The image icon to draw.virtual void DrawIcon( PORDINATE x, PORDINATE y, const PIcon & icn )
y - The Y position at which to draw the icon.
icn - The icon to draw.virtual void DrawPixels( PORDINATE x, PORDINATE y, const PPixelImage & pix )
y - The Y position at which to draw the pixels.
pix - The pixel image to draw.virtual void DrawPixels( const PRect & rect, const PPixelImage & pix )
pix - The pixel image to draw.virtual void DrawPict( PORDINATE x, PORDINATE y, const PPictImage & pic )
y - The Y position at which to draw the picture.
pic - The picture to draw.virtual void DrawPict( const PRect & rect, const PPictImage & pic )
pic - The picture to draw.enum DrawStringOptions
LeftAlign
RightAlign
Centred
Justified
HorizontalAlignmentMask
TopAlign
BottomAlign
CentreVertical
BaseLine
VerticalAlignmentMask
NoWrapping
WordWrap
CentreEllipses
EndEllipses
HorizontalWrapMask
NoTruncation
CentreTruncation
EndTruncation
VerticalTruncationMask
virtual void DrawString( PORDINATE x, PORDINATE y, const PString & str, int options = LeftAlign )
y - The Y position at which to draw the string.
str - The string to draw.
options - The alignment of the lines in the string.virtual PDIMENSION DrawString( const PRect & rect, const PString & str, int options = LeftAlign )
str - The string to draw.
options - The alignment of the lines in the string.virtual PDim MeasureString( const PString & str )
virtual PDIMENSION MeasureString(const PString & str, PDIMENSION width)
virtual void DrawTextLine( PORDINATE x, PORDINATE y, const char * textChars, const PDIMENSION * charWidths, PINDEX len )
y - The Y position to draw the text.
textChars - The array of characters to draw.
charWidths - An array with the width of each character in the text array. If this
is NULL then the default character width for the font is used.
len - The number of characters to draw.virtual PRect GetDrawingBounds() const
virtual PRect GetPhysicalBounds(BOOL inPixels = FALSE) const
virtual void SetClipRegion( const PRegion & rgn )
virtual PRegion GetClipRegion() const
virtual void SetClipRect( const PRect & rect )
virtual PRect GetClipRect() const
BOOL IsInClipRegion( const PPoint & pt ) const
PDIMENSION FromPixelsDX( PDIMENSION dx ) const
PDIMENSION ToPixelsDX( PDIMENSION dx ) const
PDIMENSION FromPointsX( PDIMENSION dx )
PDIMENSION ToPointsX( PDIMENSION dx )
virtual void _DrawRect( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height )
y - Y position of the top left corner of the rectangle to draw.
width - Width of the rectangle to draw.
height - Height of the rectangle to draw.virtual void _FillRect( PORDINATE x, PORDINATE y, PDIMENSION width, PDIMENSION height )
y - Y position of the top left corner of the rectangle to draw.
width - Width of the rectangle to draw.
height - Height of the rectangle to draw.PORDINATE Member variables
PRealFont realFont
Alphabetic index HTML hierarchy of classes or Java