Unit 'Graphics' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Abstract base class used for images in supported image formats.


Source position: graphics.pp line 788

type TGraphic = class(TPersistent)


  procedure Changed(); virtual;


Performs action needed when the image data has changed.

  function Equals(); virtual;


Determines if the specified class instance is the same as the current class instance.

  procedure DefineProperties(); override;


DefineProperties finds out whether the object really is a binary (graphic).

  procedure Draw(); virtual; abstract;


Method to Draw the Graphic on the specified Canvas, in the specified Rectangle.

  function GetEmpty; virtual; abstract;


Gets the value for the Empty property.

  function GetHeight; virtual; abstract;


Gets the value for the Height property.

  function GetMimeType; virtual;


Gets the value for the MimeType property.

  function GetPalette; virtual;


Gets the value for the Palette property.

  function GetTransparent; virtual; abstract;


Gets the value for the Transparent property.

  function GetWidth; virtual; abstract;


Gets the value for the Width property.

  procedure Progress();


Monitor the Progress of the drawing.

  procedure ReadData(); virtual;


ReadData - reads data for the Graphic from a stream.

  procedure SetHeight(); virtual; abstract;


Sets the value for the Height Property.

  procedure SetPalette(); virtual;


Sets the value for the Palette property.

  procedure SetTransparent(); virtual; abstract;


Sets the value for the Transparent property.

  procedure SetWidth(); virtual; abstract;


Sets the value for the Width property.

  procedure SetModified();


Sets the value for the Modified property.

  procedure WriteData(); virtual;


WriteData - writes Graphic data to a stream.


  procedure Assign(); override;


Checks if there really is a source to assign (if not, calls Clear), then calls inherited method.

  constructor Create; virtual;


Create - constructor for TGraphic: calls inherited Create.

  procedure Clear; virtual;


Clear the resources used by the Graphic, leaving a blank Graphic.

  function TyphonResourceTypeValid(); virtual;


Determines if the specified resource type is valid for the image format.

  procedure LoadFromFile(); virtual;


Reads data for the graphic from a file.

  procedure LoadFromStream(); virtual; abstract;


Reads graphic data from a stream.

  procedure LoadFromMimeStream(); virtual;


Loads the from the specified stream for the given MIME type.

  procedure LoadFromTyphonResource(); virtual;


Load the graphic data from a Typhon Resource (.ctrs) file.

  procedure LoadFromResourceName(); virtual;


Loads a resource with the specified name from the given handle.

  procedure LoadFromResourceID(); virtual;


Load graphic data from a resource identified by the integer identifier ResID.

  procedure LoadFromClipboardFormat(); virtual;


LoadFromClipboardFormat - Replace the current image with the contents of the clipboard.

  procedure LoadFromClipboardFormatID(); virtual;


Load the data from the clipboard using the format type specified by ClipboardType and the format identifier FormatID.

  procedure SaveToFile(); virtual;


Writes graphic data to the specified file name.

  procedure SaveToStream(); virtual; abstract;


SaveToStream - write graphic data to a stream.

  procedure SaveToClipboardFormat(); virtual;


SaveToClipboardFormats - Converts the image to a clipboard format.

  procedure SaveToClipboardFormatID(); virtual;


Saves the data to a clipboard of Type ClipboardType using the format FormatID.

  procedure GetSupportedSourceMimeTypes(); virtual;


Gets a list of supported MIME types for data used in the graphic.

  function GetResourceType; virtual;


Gets the Integer Resource Type for the class instance.

  class function GetFileExtensions; virtual;


Returns a list of the file extensions available.

  class function IsStreamFormatSupported(); virtual;


Indicates whether the specified stream type is supported in the class.

  property Empty: Boolean; [r]


Indicates if the graphic is empty (contains no data).

  property Height: Integer; [rw]


The native, unstretched height for the graphic.

  property Modified: Boolean; [rw]


Indicates if the graphic data in the class instance has been modified.

  property MimeType: string; [r]


MimeType - the MIME type of the graphic.

  property OnChange: TNotifyEvent; [rw]


Event handler signalled when data in the class instance is changed.

  property OnProgress: TFPImgProgressEvent; [rw]


Event handler signalled to track the progress of operations in the class instance.

  property Palette: HPALETTE; [rw]


Handle to the color palette used in image data.

  property PaletteModified: Boolean; [rw]


Indicates whether the palette of colors been modified.

  property Transparent: Boolean; [rw]


Indicates whether some parts of the image are not opaque.

  property Width: Integer; [rw]


Width - The native, unstretched, width of the graphic.





Abstract base class used for images in supported image formats.




The TGraphic class is an abstract base class for graphic images in image formats supported in the LCL. TGraphic establishes an API that is used in the LCL to read and write image data using a file, stream, resource, or the clipboard. Many of its methods are defined as virtual and/or abstract, and must be implemented (or re-implemented) in descendent classes to provide support for specific image formats.

Methods defined in TGraphic include:

TGraphic does not contain a mechanism for displaying or rendering an image. This capability is implemented in descendent classes which provide a TCanvas suitable for the image data, such as: TRasterImage, TBitmap, TIcon, TPixmap, TJPegImage, TGifImage, et. al.

Properties common to most image formats are defined in the class, and include:

Event handlers are provided for change and progress notifications, including:

TGraphic is the type used to implement the Graphic property in TPicture, and passed as an argument to methods in TCanvas.

See also



Implements a container for TGraphic and descendent classes.



Implements a FCL-compatible reader/writer for a Bitmap image.



Implements an icon image type; small images typically associated with applications, controls, etc.



TJPEGImage - a class for handling images stored in JPEG (compressed) format.



Implements an image using the GIF (Graphics Interchange Format) image format.



Implements support for the XPM (Pixmap) image format.



Implements support for the PNG image format.



Implements an image which supports for the Portable Any Map (PNM) graphic format.



Implements a drawing surface for a visual control or bitmap image.

CT Web help

CodeTyphon Studio