ICanvas (Canvas object)
1. Definition
The canvas object is of type ICanvas and derives from ISlideShowObject. It provides the opportunity to draw simple geometric shapes.
ICanvas inherits from ISlideShowObject function GetWidth: Integer; procedure SetWidth(const Value: Integer); function GetHeight: Integer; procedure SetHeight(const Value: Integer); procedure SetBrush(Color: Integer); procedure SetPen(Color: Integer); procedure DrawRect(top, left, bottom, right: Integer); procedure DrawRectF(top, left, bottom, right: Single); procedure DrawEllipse(top, left, bottom, right: Integer); procedure DrawBitmap(Bitmap: ICanvas; DTop, DLeft, STop, SLeft, SBottom, SRight: Integer); procedure DrawPolygon(points: TPointFArray; fillStyle: TFillStyle); end;
2. Methods
-
Object creation
function CreateBitmap: ICanvas;
-
Creates a Canvas object by loading an image file. The image files are looked up in the SlideShow Presets folder.
function CreateBitmap: ICanvas; function CreateBitmapFromFile(FileName: string): ICanvas;
-
Width of the canvas in pixels
function GetWidth: Integer; procedure SetWidth(const Value: Integer);
-
Height of the canvas in pixels
function GetHeight: Integer; procedure SetHeight(const Value: Integer);
-
Set fill color, 32 Bit color depth
procedure SetBrush(Color: Integer);
-
Set line color, 32 Bit color depth
procedure SetPen(Color: Integer);
-
Draw rectangle; specification of the top, left, bottom and right border (BoundingBox) in pixels; Single as well as Integer values are possible
procedure DrawRect(top, left, bottom, right: Integer); procedure DrawRectF(top, left, bottom, right: Single);
-
Draw ellipse; specification of the top, left, bottom and right border (BoundingBox) in pixels
procedure DrawEllipse(top, left, bottom, right: Integer);
-
Draw circle from the center, indicating the radius
procedure DrawCircleCenter(centerX, centerY, radius: Integer);
-
Fit maximum circle in specified bounding box
procedure DrawCircle(top, left, bottom, right: Integer);
-
Draw another bitmap or a section of it on the canvas
- Bitmap: another Canvas object
- DTop, DLeft: upper left coordinate of the current canvas; The upper left corner of the object to be drawn will lie there.
- STop, SLeft, SBottom, SRight: Section of a bitmap to be drawn
procedure DrawBitmap(Bitmap: ICanvas; DTop, DLeft, STop, SLeft, SBottom, SRight: Integer);
-
Draw polygons
- Points: array of TPointF, List of Points
- TPointF can be created by using TPointF.Create(X, Y) with X, Y as Single
- FillStyle: OddEven or Outer, Fill method
procedure DrawPolygon(points: TPointFArray; fillStyle: TFillStyle);
- Points: array of TPointF, List of Points