Class TCustomCanvas

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TCustomCanvas = class abstract(TObject)

Description

Abstract canvas definition that provides few basic functions that need to be implemented by derived classes and many different rendering functions that internally use basic functions to do the rendering.

Hierarchy

  • TObject
  • TCustomCanvas

Overview

Fields

Protected FCurrentPremultipliedAlpha: Boolean;
Protected FCurrentTexture: TCustomBaseTexture;
Protected FCurrentTextureMapping: TQuad;

Methods

Public constructor Create(const ADevice: TCustomDevice);
Public function BeginScene: Boolean;
Public function Initialize: Boolean;
Public function SetEffect(const AEffect: TCustomCanvasEffect): Boolean; virtual;
Public function SetPalette(const Palette: TIntColorPalette): Boolean; virtual;
Protected function BeginDraw: Boolean; virtual;
Protected function DeviceRestore: Boolean; virtual;
Protected function GetClipRect: TIntRect; virtual; abstract;
Protected function InitCanvas: Boolean; virtual;
Protected function NeedsInitialization: Boolean; virtual;
Public procedure Circle(const Origin: TPoint2f; const Radius: VectorFloat; const Steps: Integer; const Color: TIntColor; const UseWuLines: Boolean = False);
Public procedure DrawIndexedTriangles(const Vertices: PPoint2f; const Colors: PIntColor; const Indices: PLongInt; const VertexCount, TriangleCount: Integer; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); virtual; abstract;
Public procedure DrawTexturedTriangles(const Texture: TCustomBaseTexture; const Vertices, TexCoords: PPoint2f; const Colors: PIntColor; const Indices: PLongInt; const VertexCount, TriangleCount: Integer; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); virtual; abstract;
Public procedure Ellipse(const Origin, Radius: TPoint2f; const Steps: Integer; const Color: TIntColor; const UseWuLines: Boolean = False);
Public procedure EndScene;
Public procedure FillArc(const X, Y, Radius, InitAngle, EndAngle: VectorFloat; const Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect); overload;
Public procedure FillArc(const Origin, Radius: TPoint2f; const InitAngle, EndAngle: VectorFloat; const Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FillCircle(X, Y, Radius: VectorFloat; Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure FillEllipse(const Origin, Radius: TPoint2f; Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure FillHexagon(const Matrix: TMatrix3f; const Color1, Color2, Color3, Color4, Color5, Color6: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure FillQuad(const Points: TQuad; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure FillRect(const Left, Top, Width, Height: VectorFloat; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FillRect(const Rect: TFloatRect; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FillRect(const Rect: TFloatRect; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FillRibbon(const Origin, InsideRadius, OutsideRadius: TPoint2f; const InitAngle, EndAngle: VectorFloat; const Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FillRibbon(const Origin, InsideRadius, OutsideRadius: TPoint2f; const InitAngle, EndAngle: VectorFloat; const Steps: Integer; const InsideColor1, InsideColor2, InsideColor3, OutsideColor1, OutsideColor2, OutsideColor3: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FillTri(const Point1, Point2f, Point3: TPoint2f; const Color1, Color2, Color3: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure Finalize;
Public procedure Flush; virtual; abstract;
Public procedure FrameRect(const Points: TQuad; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure FrameRect(const Rect: TFloatRect; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure HorizLine(const Left, Top, Width: VectorFloat; const Colors: TColorPair; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure HorizLine(const Left, Top, Width: VectorFloat; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure Line(const SrcPoint, DestPoint: TPoint2f; const Color: TColorPair); overload; virtual; abstract;
Public procedure Line(const SrcPoint, DestPoint: TPoint2f; const Color: TIntColor); overload;
Public procedure Line(const X1, Y1, X2, Y2: VectorFloat; const Color: TIntColor); overload;
Public procedure Line(const X1, Y1, X2, Y2: VectorFloat; const Color: TColorPair); overload;
Public procedure LineArray(const Points: PPoint2f; const ElementCount: Integer; const Color: TIntColor); virtual;
Public procedure PutPixel(const Point: TPoint2f; const Color: TIntColor); overload; virtual; abstract;
Public procedure PutPixel(const X, Y: VectorFloat; const Color: TIntColor); overload;
Public procedure QuadHole(const AreaTopLeft, AreaSize, HoleOrigin, HoleRadius: TPoint2f; const OutsideColor, InsideColor: TIntColor; const Steps: Integer; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure Reset; virtual;
Public procedure ResetPalette; virtual;
Public procedure TexQuad(const Points: TQuad; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);
Public procedure UseImage(const Image: TCustomCanvasImage; const Mapping: TQuad; const TextureIndex: Integer = 0); overload;
Public procedure UseImage(const Image: TCustomCanvasImage); overload;
Public procedure UseImagePx(const Image: TCustomCanvasImage; const Mapping: TQuad; const TextureIndex: Integer = 0);
Public procedure UseImageRegion(const Image: TCustomCanvasImage; const Region: Integer; const Mirror, Flip: Boolean); overload;
Public procedure UseImageRegion(const Image: TCustomCanvasImage; const Region: Integer; const SrcRect: TIntRect; const Mirror: Boolean = False; const Flip: Boolean = False); overload;
Public procedure UseImageRegion(const Image: TCustomCanvasImage; const Region: Integer = 0); overload;
Public procedure UseTexture(const Texture: TCustomBaseTexture; const Mapping: TQuad);
Public procedure UseTexturePx(const Texture: TCustomBaseTexture; const Mapping: TQuad);
Public procedure VertLine(const Left, Top, Height: VectorFloat; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure VertLine(const Left, Top, Height: VectorFloat; const Colors: TColorPair; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;
Public procedure WireHexagon(const Matrix: TMatrix3f; const Color1, Color2, Color3, Color4, Color5, Color6: TIntColor; const UseWuLines: Boolean = False);
Public procedure WireQuad(const Points: TQuad; const Colors: TColorRect; const UseWuLines: Boolean = False);
Public procedure WuLine(const Point1, Point2f: TPoint2f; const Color: TColorPair);
Protected procedure DeviceRelease; virtual;
Protected procedure DoneCanvas; virtual;
Protected procedure EndDraw; virtual;
Protected procedure NextDrawCall; virtual;
Protected procedure SetClipRect(const Value: TIntRect); virtual; abstract;
Protected procedure UpdateAttributes; virtual;

Properties

Public property Attributes: TCanvasAttributes read FAttributes write SetAttributes;
Public property CacheStall: Integer read FCacheStall;
Public property ClipRect: TIntRect read GetClipRect write SetClipRect;
Public property Device: TCustomDevice read FDevice;
Public property Initialized: Boolean read FInitialized;
Public property Parent: TCustomCanvasParent read FParent;

Description

Fields

Protected FCurrentPremultipliedAlpha: Boolean;

Currently set rendering mode in relation to premultiplied or non-premultiplied alpha.

Protected FCurrentTexture: TCustomBaseTexture;

Currently defined texture for rendering.

Protected FCurrentTextureMapping: TQuad;

Currently defined coordinates within the texture set in FCurrentTexture.

Methods

Public constructor Create(const ADevice: TCustomDevice);

Creates new instance of canvas bound to the specific device.

Public function BeginScene: Boolean;

Prepares the canvas to start the rendering. Any rendering calls can be made after this method succeeds. Returns True when successful and False otherwise.

Public function Initialize: Boolean;

Initializes the canvas so it can be used for rendering. Note that for actual rendering to take place, BeginScene needs to be called first, assuming that initialization succeeded. This results True when successful and False otherwise.

Public function SetEffect(const AEffect: TCustomCanvasEffect): Boolean; virtual;

Sets custom shader effect to be used for rendering. This functionality may be provider and platform dependent. Also, for this to work, TCanvasAttribute.CustomEffect should be set in Attributes.

Public function SetPalette(const Palette: TIntColorPalette): Boolean; virtual;

Sets the palette to be used for rendering 8-bit indexed images. Support for such images varies depending on provider and platform. This returns True when successful and False otherwise.

Protected function BeginDraw: Boolean; virtual;

Prepares the canvas for rendering, after which any number of rendering calls can be made. Returns True when successful and False otherwise.

Protected function DeviceRestore: Boolean; virtual;

Restores the canvas after its resources have been lost (that is, after DeviceRelease call). This may be implemented by derived classes to handle "device lost" scenario.

Protected function GetClipRect: TIntRect; virtual; abstract;

Returns the currently set clipping rectangle.

Protected function InitCanvas: Boolean; virtual;

Creates any implementation specific resources for rendering, including hardware and/or GPU resources. Returns True when successful and False otherwise.

Protected function NeedsInitialization: Boolean; virtual;

Depending on actual implementation, this indicates whether the canvas requires initialization or not. When this method returns False, then the canvas becomes initialized at the creation and cannot be "finalized".

Public procedure Circle(const Origin: TPoint2f; const Radius: VectorFloat; const Steps: Integer; const Color: TIntColor; const UseWuLines: Boolean = False);

Draws circle with given origin, radius and color. This function uses Line primitive. Steps parameter indicates number of divisions in the ellipse. UseWuLines determines whether to use WuLine primitive instead.

Public procedure DrawIndexedTriangles(const Vertices: PPoint2f; const Colors: PIntColor; const Indices: PLongInt; const VertexCount, TriangleCount: Integer; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); virtual; abstract;

Draws one or more triangles filled with color gradient, specified by vertex, color and index buffers. This method is considered basic functionality and should always be implemented by derived classes.

Public procedure DrawTexturedTriangles(const Texture: TCustomBaseTexture; const Vertices, TexCoords: PPoint2f; const Colors: PIntColor; const Indices: PLongInt; const VertexCount, TriangleCount: Integer; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); virtual; abstract;

Draws one or more triangles filled with texture and color gradient, specified by vertex, texture coordinates, color and index buffers.This method is considered basic functionality and should always be implemented by derived classes.

Public procedure Ellipse(const Origin, Radius: TPoint2f; const Steps: Integer; const Color: TIntColor; const UseWuLines: Boolean = False);

Draws ellipse with given origin, radiuses and color. This function uses Line primitive. Steps parameter indicates number of divisions in the ellipse. UseWuLines indicates whether to use WuLine primitive instead.

Public procedure EndScene;

Finishes rendering phase in the canvas.

Public procedure FillArc(const X, Y, Radius, InitAngle, EndAngle: VectorFloat; const Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect); overload;

Draws filled arc at the given coordinates and radius. The arc begins at InitAngle and ends at EndAngle (in radians), subdivided into a number of triangles specified in Steps. The arc's shape is filled with four color gradient.

Public procedure FillArc(const Origin, Radius: TPoint2f; const InitAngle, EndAngle: VectorFloat; const Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws filled arc at the given position and radius. The arc begins at InitAngle and ends at EndAngle (in radians), subdivided into a number of triangles specified in Steps. The arc's shape is filled with four color gradient.

Public procedure FillCircle(X, Y, Radius: VectorFloat; Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws filled circle at the given position and radius. The circle is subdivided into a number of triangles specified in Steps. The shape of circle is filled with four color gradient.

Public procedure FillEllipse(const Origin, Radius: TPoint2f; Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws filled ellipse at the given position and radius. The ellipse is subdivided into a number of triangles specified in Steps. The shape of ellipse is filled with four color gradient.

Public procedure FillHexagon(const Matrix: TMatrix3f; const Color1, Color2, Color3, Color4, Color5, Color6: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws hexagon where vertices are spaced 0.5 pixels apart from its center (so diameter is 1) in all directions, multiplied by the given matrix and filled with gradient of six colors at the corresponding vertices. The size, position and rotation of hexagon can be given using one or a combination of several 3x3 matrices multiplied together.

Public procedure FillQuad(const Points: TQuad; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws quadrilateral with color gradient specified by given vertices and colors.

Public procedure FillRect(const Left, Top, Width, Height: VectorFloat; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws rectangle filled with single color and specified by given coordinates, and colors.

Public procedure FillRect(const Rect: TFloatRect; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws rectangle filled with single color and specified by given margins, and colors.

Public procedure FillRect(const Rect: TFloatRect; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws rectangle with color gradient specified by given margins and colors.

Public procedure FillRibbon(const Origin, InsideRadius, OutsideRadius: TPoint2f; const InitAngle, EndAngle: VectorFloat; const Steps: Integer; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws filled ribbon at the given position between inner and outer radiuses. The ribbon begins at InitAngle and ends at EndAngle (in radians), subdivided into a number of triangles specified in Steps. The ribbon's shape is filled with four color gradient.

Public procedure FillRibbon(const Origin, InsideRadius, OutsideRadius: TPoint2f; const InitAngle, EndAngle: VectorFloat; const Steps: Integer; const InsideColor1, InsideColor2, InsideColor3, OutsideColor1, OutsideColor2, OutsideColor3: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws filled ribbon at the given position between inner and outer radiuses. The ribbon begins at InitAngle and ends at EndAngle (in radians), subdivided into a number of triangles specified in Steps. The ribbon's shape is filled with continuous gradient set by three pairs of inner and outer colors.

Public procedure FillTri(const Point1, Point2f, Point3: TPoint2f; const Color1, Color2, Color3: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws triangle filled with color gradient specified by given positions and colors.

Public procedure Finalize;

Finalizes the canvas and releases any resources that were previously allocated during initialization.

Public procedure Flush; virtual; abstract;

Flushes the canvas cache and presents the pending primitives on the destination surface. This can be useful to make sure that nothing remains in canvas cache before starting to render, for instance, a 3D scene.

Public procedure FrameRect(const Points: TQuad; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws rectangle with line width of one pixel specified by given vertices and colors. Although this may receive coordinates for shapes other than rectangle (for example, quadrilateral), the result may be unpredictable. This method unlike other line drawing methods uses filled shapes and assumes that four vertices are aligned to form rectangle. The produced result respects last pixel rule and can be used for drawing UI elements (whereas methods like WireQuad may produce incorrectly sized rectangles depending on implementation).

Public procedure FrameRect(const Rect: TFloatRect; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws rectangle with line width of one pixel specified by given margins and colors. This works in similar fashion as other overloaded FrameRect method by drawing filled shapes instead of lines, and is meant for rendering UI elements.

Public procedure HorizLine(const Left, Top, Width: VectorFloat; const Colors: TColorPair; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws horizontal line with specified coordinates and color gradient. This method uses filled shapes instead of actual lines to produce accurate results and is meant for rendering UI elements.

Public procedure HorizLine(const Left, Top, Width: VectorFloat; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws horizontal line with specified coordinates and single color. This method uses filled shapes instead of actual lines to produce accurate results and is meant for rendering UI elements.

Public procedure Line(const SrcPoint, DestPoint: TPoint2f; const Color: TColorPair); overload; virtual; abstract;

Draws line between two specified positions and filled with color gradient. This method is considered basic functionality and should always be implemented by derived classes.

Public procedure Line(const SrcPoint, DestPoint: TPoint2f; const Color: TIntColor); overload;

Draws line between two specified positions and filled with single color.

Public procedure Line(const X1, Y1, X2, Y2: VectorFloat; const Color: TIntColor); overload;

Draws line between specified coordinate pairs and filled with single color.

Public procedure Line(const X1, Y1, X2, Y2: VectorFloat; const Color: TColorPair); overload;

Draws line between specified coordinate pairs and filled with color gradient.

Public procedure LineArray(const Points: PPoint2f; const ElementCount: Integer; const Color: TIntColor); virtual;

Draws series of lines between specified vertices using solid color.

Public procedure PutPixel(const Point: TPoint2f; const Color: TIntColor); overload; virtual; abstract;

Draws a single pixel on the destination surface with the specified position and color (alpha-blended). This method is considered basic functionality and should always be implemented by derived classes.

Public procedure PutPixel(const X, Y: VectorFloat; const Color: TIntColor); overload;

Draws a single pixel on the destination surface with the specified coordinates and color (alpha-blended).

Public procedure QuadHole(const AreaTopLeft, AreaSize, HoleOrigin, HoleRadius: TPoint2f; const OutsideColor, InsideColor: TIntColor; const Steps: Integer; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws a filled rectangle at the given position and size with a hole (in form of ellipse) inside at the given center and radius. The quality of the hole is defined by the value of Steps in number of subdivisions. This entire shape is filled with gradient starting from outer color at the edges of rectangle and inner color ending at the edge of hole. This shape can be particularly useful for highlighting items on the screen by darkening the entire area except the one inside the hole.

Public procedure Reset; virtual;

Resets all the states necessary for canvas operation. This can be useful when custom state changes have been made (for instance, in a 3D scene) so to restore the canvas to its working condition this method should be called.

Public procedure ResetPalette; virtual;

Resets the palette to be used for rendering 8-bit indexed images that was previously set by SetPalette.

Public procedure TexQuad(const Points: TQuad; const Colors: TColorRect; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal);

Draws textured rectangle at given vertices and multiplied by the specified four color gradient. The texture must be set prior to this call by one of UseTexture[...] or UseImage[...] calls. For every call of TexQuad there must be a preceding UseTexture[...] or UseImage[...] call to specify the image or texture. All pixels of the rendered texture are multiplied by the gradient color before applying alpha-blending. If the texture has no alpha-channel present, alpha value of the gradient will be used instead.

Public procedure UseImage(const Image: TCustomCanvasImage; const Mapping: TQuad; const TextureIndex: Integer = 0); overload;

Defines the specified image with one of its textures to be used in next call to TexQuad. The coordinates inside the texture are defined in logical units in range of [0..1].

Public procedure UseImage(const Image: TCustomCanvasImage); overload;

Defines the specified image to be used in next call to TexQuad. If the image has multiple textures, then the first one will be used.

Public procedure UseImagePx(const Image: TCustomCanvasImage; const Mapping: TQuad; const TextureIndex: Integer = 0);

Defines the specified image with one of its textures to be used in next call to TexQuad. The coordinates inside the texture are defined in pixels using floating-point coordinates.

Public procedure UseImageRegion(const Image: TCustomCanvasImage; const Region: Integer; const Mirror, Flip: Boolean); overload;

Defines the specified region of the image to be used in next call to TexQuad. That region can also be mirrored horizontally and/or flipped vertically, if needed. If the image has no or just one pattern, the value of Region should be set to zero; in this case, the entire texture is used instead.

Public procedure UseImageRegion(const Image: TCustomCanvasImage; const Region: Integer; const SrcRect: TIntRect; const Mirror: Boolean = False; const Flip: Boolean = False); overload;

Defines the specified region of the image to be used in next call to TexQuad. Only a certain portion of that region is used for rendering defined by the given coordinates; these coordinates can also be mirrored horizontally and/or flipped vertically, if needed. If the image has no or just one pattern, the value of Region should be set to zero; in this case, the entire texture is used instead.

Public procedure UseImageRegion(const Image: TCustomCanvasImage; const Region: Integer = 0); overload;

Defines the specified region of the image to be used in next call to TexQuad. If the image has none or just one region defined, the value of Region should be set to zero; in this case, the entire texture is used instead.

Public procedure UseTexture(const Texture: TCustomBaseTexture; const Mapping: TQuad);

Defines the specified texture to be used in next call to TexQuad. The coordinates inside the texture are defined in logical units in range of [0..1].

Public procedure UseTexturePx(const Texture: TCustomBaseTexture; const Mapping: TQuad);

Defines the specified texture to be used in next call to TexQuad. The coordinates inside the texture are defined in pixels using floating-point coordinates.

Public procedure VertLine(const Left, Top, Height: VectorFloat; const Color: TIntColor; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws vertical line with specified coordinates and single color. This method uses filled shapes instead of actual lines to produce accurate results and is meant for rendering UI elements.

Public procedure VertLine(const Left, Top, Height: VectorFloat; const Colors: TColorPair; const BlendingEffect: TBlendingEffect = TBlendingEffect.Normal); overload;

Draws vertical line with specified coordinates and color gradient. This method uses filled shapes instead of actual lines to produce accurate results and is meant for rendering UI elements.

Public procedure WireHexagon(const Matrix: TMatrix3f; const Color1, Color2, Color3, Color4, Color5, Color6: TIntColor; const UseWuLines: Boolean = False);

Draws lines between each vertex in hexagon. The vertices are spaced 0.5 pixels apart from its center (so diameter is 1) in all directions, multiplied by the given matrix and filled with gradient of six colors at the corresponding vertices. The size, position and rotation of hexagon can be given using one or a combination of several 3x3 matrices multiplied together. This method uses Line primitive. UseWuLines determines whether to use WuLine primitive instead.

Public procedure WireQuad(const Points: TQuad; const Colors: TColorRect; const UseWuLines: Boolean = False);

Draws lines between the specified vertices (making it a wireframe quadrilateral) and vertex colors. Note that this may not necessarily respect last pixel rendering rule). This method uses Line primitive. UseWuLines determines whether to use WuLine primitive instead.

Public procedure WuLine(const Point1, Point2f: TPoint2f; const Color: TColorPair);

Draws antialiased "wu-line" using PutPixel primitive between specified positions filled with single color.

Protected procedure DeviceRelease; virtual;

Releases the resources of canvas when the device has been lost. This may be implemented by derived classes to handle "device lost" scenario.

Protected procedure DoneCanvas; virtual;

Releases any implementation specific resources for rendering, including hardware and/or GPU resources.

Protected procedure EndDraw; virtual;

Finishes rendering and depending on implementation may present results on destination surface.

Protected procedure NextDrawCall; virtual;

This method can be called by specific implementations to indicate that canvas buffer is full and new rendering stage begins. Basically, this increments CacheStall by one, which by default is reset back to zero after call to BeginScene.

Protected procedure SetClipRect(const Value: TIntRect); virtual; abstract;

Specifies new clipping rectangle for rendering.

Protected procedure UpdateAttributes; virtual;

Makes the necessary arrangements so that newly set canvas attributes are taken into account for next rendering calls.

Properties

Public property Attributes: TCanvasAttributes read FAttributes write SetAttributes;

Defines one or more canvas attributes that affect the rendering behavior.

Public property CacheStall: Integer read FCacheStall;

Number of times that rendering cache was reset during last rendering frame. Each cache reset is typically a time-consuming operation so high number of such events could be detrimental to the application's rendering performance. If this parameter happens to be considerably high in the rendered scene, the rendering code should be revised for better grouping of images, shapes and blending types.

Public property ClipRect: TIntRect read GetClipRect write SetClipRect;

The clipping rectangle in which the rendering will be made. This can be useful for restricting the rendering to a certain portion of surface.

Public property Device: TCustomDevice read FDevice;

The device to which this canvas is bound to.

Public property Initialized: Boolean read FInitialized;

Indicates whether the canvas has been initialized by using Initialize function.

Public property Parent: TCustomCanvasParent read FParent;

Provides access to canvas parent if there is such.


Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.