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

TPicture

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

Implements a container for TGraphic and descendent classes.

Declaration

Source position: graphics.pp line 883

type TPicture = class(TPersistent)

protected

  procedure AssignTo(); override;

  

AssignTo if Dest is the correct (Graphic) class type, calls Assign for Dest, otherwise calls inherited AssignTo.

  procedure Changed(); virtual;

  

Performs actions needed when value(s) in the class instance have been modified.

  procedure DefineProperties(); override;

  

Defines properties handled during LCL component streaming.

  procedure Progress(); virtual;

  

Monitors progress of a drawing process.

  procedure LoadFromStreamWithClass();

  

Loads values for the Graphic property from a stream using the specified class type.

public

  constructor Create;

  

Create - constructor for TPicture: performs inherited Create then loads file and clipboard formats.

  destructor Destroy; override;

  

Destroy - destructor for TPicture: frees graphic then performs inherited Destroy.

  procedure Clear; virtual;

  

Clear - removes the Graphic in the class instance.

  procedure LoadFromClipboardFormat();

  

LoadFromClipboardFormat - Reads the picture from the handle provided in the given clipboard format.

  procedure LoadFromClipboardFormatID();

  

Reads the picture from a clipboard of type ClipboardType using the format FormatID.

  procedure LoadFromFile();

  

LoadFromFile - Reads a picture from disk.

  procedure LoadFromResourceName();

  

Loads content from the specified resource into the Graphic property.

  procedure LoadFromLazarusResource();

  

Gets the named resource from a Lazarus Resource (.lrs) file.

  procedure LoadFromStream();

  

Loads a supported image format from the specified stream.

  procedure LoadFromStreamWithFileExt();

  

Loads the picture from a stream containing data for the specified file extension.

  procedure SaveToClipboardFormat();

  

SaveToClipboardFormats - Allocates a global handle and writes the picture in its native clipboard format.

  procedure SaveToFile();

  

SaveToFile - Writes the picture to disk.

  procedure SaveToStream();

  

Saves the graphic to the specified stream.

  procedure SaveToStreamWithFileExt();

  

Saves the graphic to a stream using the class type for the specified file extension.

  class function SupportsClipboardFormat();

  

SupportsClipboardFormat - Returns True if the given clipboard format is supported by LoadFromClipboardFormat.

  procedure Assign(); override;

  

Assign - if the Source is a valid graphic type, copy the relevant details to the current object, otherwise call inherited Assign.

  class procedure RegisterFileFormat();

  

Registers a new TGraphic class for use in LoadFromFile.

  class procedure RegisterClipboardFormat();

  

Registers a new TGraphic class for use in LoadFromClipboardFormat.

  class procedure UnregisterGraphicClass();

  

Removes all references to the specified TGraphic.

  class function FindGraphicClassWithFileExt();

  

Finds a graphic class with the named file extension Ext, and raises an exception if not found.

  property Bitmap: TBitmap; [rw]

  

Bitmap - Returns a bitmap.

  property Icon: TIcon; [rw]

  

Icon contained within the picture.

  property Jpeg: TJpegImage; [rw]

  

Jpeg - returns a JPEG image.

  property Pixmap: TPixmap; [rw]

  

Pixmap - Returns a pixmap.

  property PNG: TPortableNetworkGraphic; [rw]

  

PNG - Returns a png.

  property PNM: TPortableAnyMapGraphic; [rw]

  

PNM - a PortableAnyMapGraphic image.

  property Graphic: TGraphic; [rw]

  

Graphic - The TGraphic object contained by the TPicture.

  property Height: Integer; [r]

  

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

  property Width: Integer; [r]

  

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

  property OnChange: TNotifyEvent; [rw]

  

OnChange - Event handler for any change in the picture.

  property OnProgress: TProgressEvent; [rw]

  

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

end;

Inheritance

TPicture

  

Implements a container for TGraphic and descendent classes.

|

TPersistent,IFPObserved

|

TObject

Description

TPicture is a TGraphic container. It is used in place of a TGraphic if the graphic can be of any TGraphic class.

It is not a direct descendant of TGraphic, so you will not see TGraphic listed in the Inheritance chart, but it contains a property Graphic, of type TGraphic, so can contain all the properties of a TGraphic.

Defines many private methods for getting and storing various sorts of images such as bitmaps, pixmaps, icons, PNGs etc.

TPicture does not have a defined area used to display the image. This is supplied in the Canvas property in the classes which support BitMap, PixMap, PNG, JPEG, GIF, TIFF or Icon image formats.

LoadFromFile and SaveToFile are polymorphic. For example, if the TPicture is holding an Icon, you can LoadFromFile a bitmap file, whereas if the class is TIcon you could only read .ICO files.


Version 3.2 Generated 2024-02-25 Home