[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Graphics' (#lcl)

TGraphic

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

Abstract base class used for images in supported image formats.

Declaration

Source position: graphics.pp line 809

type TGraphic = class(TPersistent)

protected

  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 used 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;

  

Writes the data for the Graphic to a stream.

public

  procedure Assign(); override;

  

Implements object persistence for the TGraphic type.

  constructor Create; virtual;

  

Constructor for the class instance.

  procedure Clear; virtual;

  

Clear has an empty implementation in TGraphic.

  function LazarusResourceTypeValid(); 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 LoadFromLazarusResource(); virtual;

  

Load the graphic data from a Lazarus Resource (.lrs) 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: TProgressEvent; [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.

end;

Inheritance

TGraphic

  

Abstract base class used for images in supported image formats.

|

TPersistent,IFPObserved

|

TObject

Description

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

TPicture

  

Implements a container for TGraphic and descendent classes.

TBitmap

  

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

TIcon

  

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

TJpegImage

  

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

TGIFImage

  

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

TPixmap

  

Implements support for the XPM (Pixmap) image format.

TPortableNetworkGraphic

  

Implements support for the PNG image format.

TPortableAnyMapGraphic

  

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

TCanvas

  

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


Version 3.2 Generated 2024-02-25 Home