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

TGraphic

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

Base class for dealing with Graphic images

Declaration

Source position: graphics.pp line 680

type TGraphic = class(TPersistent)

protected

  procedure Changed(); virtual;

  

  function Equals(); virtual;

  

  procedure DefineProperties(); override;

  

  procedure Draw(); virtual; abstract;

  

  function GetEmpty; virtual; abstract;

  

  function GetHeight; virtual; abstract;

  

  function GetMimeType; virtual;

  

  function GetPalette; virtual;

  

  function GetTransparent; virtual; abstract;

  

  function GetWidth; virtual; abstract;

  

  procedure Progress();

  

Monitor the progress of the drawing

  procedure ReadData(); virtual;

  

  procedure SetHeight(); virtual; abstract;

  

  procedure SetPalette(); virtual;

  

  procedure SetTransparent(); virtual; abstract;

  

  procedure SetWidth(); virtual; abstract;

  

  procedure SetModified();

  

  procedure WriteData(); virtual;

  

public

  procedure Assign(); override;

  

  constructor Create; virtual;

  

TGraphic constructor

  procedure Clear; virtual;

  

  function LazarusResourceTypeValid(); virtual;

  

Check that the Resource specified for reading or writing is a valid type - result True if it is

  procedure LoadFromFile(); virtual;

  

LoadFromFile - Read the graphic from the file system.

  procedure LoadFromStream(); virtual; abstract;

  

LoadFromStream - reads graphic data from a stream (e.g. TBlobStream )

  procedure LoadFromMimeStream(); virtual;

  

LoadFromMimeStream - reads graphic data from a MIME stream

  procedure LoadFromLazarusResource(); virtual;

  

Load the graphic data from a Lazarus Resource (eg a *.lrs file)

  procedure LoadFromResourceName();

  

Load the graphic data from a resource identified by the name ResName with the Handle 'Instance'

  procedure LoadFromResourceID();

  

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;

  

SaveToFile - Writes the graphic to disk in the file provided.

  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 the MIME types that are supported

  function GetResourceType; virtual;

  

  function GetFileExtensions; virtual;

  

  property Empty: Boolean; [r]

  

Is this an empty (blank) graphic?

  property Height: Integer; [rw]

  

Height - The native, unstretched, height of the graphic.

  property Modified: Boolean; [rw]

  

Has the graphic been modified?

  property MimeType: String; [r]

  

  property OnChange: TNotifyEvent; [rw]

  

Event handler for any change in the data

  property OnProgress: TProgressEvent; [rw]

  

Event handler for monitoring progress of the graphic

  property Palette: HPALETTE; [rw]

  

Palette - Color palette of image

  property PaletteModified: Boolean; [rw]

  

Has the palette of colours been modified?

  property Transparent: Boolean; [rw]

  

Transparent - Some parts of the image are not opaque. ie the background can be seen through

  property Width: Integer; [rw]

  

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

end;

Inheritance

TGraphic

  

Base class for dealing with Graphic images

|

TPersistent

|

TObject

Description

The TGraphic class is an abstract base class for dealing with graphic images such as bitmaps, pixmaps, icons, and other image formats. It does not contain an actual area for displaying the image; this is provided by the descendant classes eg BitMap, Icon etc which have a Canvas element defined
LoadFromFile - Read the graphic from the file system. The old contents of the graphic are lost. If the file is not of the right format, an exception will be generated.
SaveToFile - Writes the graphic to disk in the file provided.
LoadFromStream - Like LoadFromFile except source is a stream (e.g. TBlobStream ).
SaveToStream - stream analogue of SaveToFile .
LoadFromClipboardFormat - Replaces the current image with the data provided. If the TGraphic does not support that format it will generate an exception.
SaveToClipboardFormats - Converts the image to a clipboard format. If the image does not support being translated into a clipboard format it will generate an exception.
Height - The native, unstretched, height of the graphic.
Palette - Color palette of image. Zero if graphic doesn't need/use palettes.
Transparent - Some parts of the image are not opaque, ie the background can be seen through.
Width - The native, unstretched, width of the graphic.
OnChange - Called whenever the graphic changes
PaletteModified - Indicates in OnChange whether color palette has changed. Stays true until whoever is responsible for realizing this new palette (ex: TImage) sets it to False.
OnProgress - Generic progress indicator event. Propagates out to TPicture and TImage OnProgress events.

As many of the methods and properties are virtual and/or abstract, it is the responsibility of the application programmer to supply suitable methods when implementing any descendant classes

The latest version of this document can be found at lazarus-ccr.sourceforge.net.