Class TGraphic

Unit

Declaration

type TGraphic = class(TPersistent)

Description

A class containing any element that can be drawn within rectangular bounds

Hierarchy

Overview

Methods

Public constructor Create; virtual;
Public class function GetFileExtensions: string; virtual;
Protected function GetEmpty: Boolean; virtual; abstract;
Protected function GetHeight: Integer; virtual; abstract;
Protected function GetMimeType: string; virtual;
Protected function GetTransparent: Boolean; virtual; abstract;
Protected function GetWidth: Integer; virtual; abstract;
Public procedure Clear; virtual;
Public procedure LoadFromFile(const Filename: string); virtual;
Public procedure LoadFromStream(Stream: TStream); virtual; abstract;
Public procedure SaveToFile(const Filename: string); virtual;
Public procedure SaveToStream(Stream: TStream); virtual; abstract;
Protected procedure Changed(Sender: TObject); virtual;
Protected procedure Draw(ACanvas: TCanvas; const Rect: TRect); virtual; abstract;
Protected procedure SetHeight(Value: Integer); virtual; abstract;
Protected procedure SetTransparent(Value: Boolean); virtual; abstract;
Protected procedure SetWidth(Value: Integer); virtual; abstract;

Properties

Public property Empty: Boolean read GetEmpty;
Public property Height: Integer read GetHeight write SetHeight;
Public property Transparent: Boolean read GetTransparent write SetTransparent;
Public property Width: Integer read GetWidth write SetWidth;

Description

Methods

Public constructor Create; virtual;

Create an empty instance

Public class function GetFileExtensions: string; virtual;

Returns the list of possible file extensions

Protected function GetEmpty: Boolean; virtual; abstract;

Check whether it is empty

Protected function GetHeight: Integer; virtual; abstract;

Retrieves height

Protected function GetMimeType: string; virtual;

Get mimetype of current graphic class

Protected function GetTransparent: Boolean; virtual; abstract;

Retrieves whether transparent

Protected function GetWidth: Integer; virtual; abstract;

Retrieves width

Public procedure Clear; virtual;

Clears the content

Public procedure LoadFromFile(const Filename: string); virtual;

Load the content from a given file

Public procedure LoadFromStream(Stream: TStream); virtual; abstract;

Load the content from a given stream

Public procedure SaveToFile(const Filename: string); virtual;

Saves the content to a file

Public procedure SaveToStream(Stream: TStream); virtual; abstract;

Saves the content into a given stream

Protected procedure Changed(Sender: TObject); virtual;

Notify a change

Protected procedure Draw(ACanvas: TCanvas; const Rect: TRect); virtual; abstract;

Draw the content onto a canvas

Protected procedure SetHeight(Value: Integer); virtual; abstract;

Sets the height

Protected procedure SetTransparent(Value: Boolean); virtual; abstract;

Sets whether to render as transparent

Protected procedure SetWidth(Value: Integer); virtual; abstract;

Sets the widith

Properties

Public property Empty: Boolean read GetEmpty;

Returns if the content is completely empty

Public property Height: Integer read GetHeight write SetHeight;

Returns the height of the bounding rectangle

Public property Transparent: Boolean read GetTransparent write SetTransparent;

Gets or sets if it is drawn with transparency

Public property Width: Integer read GetWidth write SetWidth;

Returns the width of the bounding rectangle