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

TPicture

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

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

Declaration

Source position: graphics.pp line 941

type TPicture = class(TPersistent) end;

protected

  procedure AssignTo(); override;

  

AssignTo if Dest is of correct (Graphic) type, calls Assign for Dest, otherwise calls inherited AssignTo

  procedure Changed(); virtual;

  

Changed - software emulation of a call to the OnChange event

  procedure DefineProperties(); override;

  

  procedure Progress(); virtual;

  

Monitor progress of drawing process

  procedure LoadFromStreamWithClass();

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

  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();

  procedure LoadFromLazarusResource();

  

  procedure LoadFromStream();

  procedure LoadFromStreamWithFileExt();

  

Loads picture from a named data stream with a 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();

  procedure SaveToStreamWithFileExt();

  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();

  

RegisterFileFormat - Register a new TGraphic class for use in LoadFromFile

  class procedure RegisterClipboardFormat();

  

RegisterClipboardFormat - Registers a new TGraphic class for use in LoadFromClipboardFormat

  class procedure UnregisterGraphicClass();

  

UnRegisterGraphicClass - Removes all references to the specified TGraphic

  function FindGraphicClassWithFileExt();

  

Finds a graphic class with the named file extension Ext, returning 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]

  

OnProgress - Event handler for monitoring progress in drawing the picture

Inheritance

TPicture

  

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

|

TPersistent

?

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
It does not itself contain a defined area for displaying the image, but this is supplied by the descendant classes such as BitMap, PixMap, PNG or Icon, which define a Canvas property.
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.

* LoadFromFile - Reads a picture from disk. The TGraphic class created is determined by the file extension of the file. If the file extension is not recognized an exception is generated.
* SaveToFile - Writes the picture to disk.
* LoadFromClipboardFormat - ToDo: Reads the picture from the handle provided in the given clipboard format. If the format is not supported, an exception is generated.
* SaveToClipboardFormats - ToDo: Allocates a global handle and writes the picture in its native clipboard format (CF_BITMAP for bitmaps, CF_METAFILE for metafiles, etc.). Formats will contain the formats written. Returns the number of clipboard items written to the array pointed to by Formats and Datas or would be written if either Formats or Datas are nil.
* SupportsClipboardFormat - Returns true if the given clipboard format is supported by LoadFromClipboardFormat
* Assign - Copies the contents of the given TPicture. Used most often in the implementation of TPicture properties.
* RegisterFileFormat - Register a new TGraphic class for use in LoadFromFile.
* RegisterClipboardFormat - Registers a new TGraphic class for use in LoadFromClipboardFormat.
* UnRegisterGraphicClass - Removes all references to the specified TGraphic class and all its descendants from the file format and clipboard format internal lists.
* Height - The native, unstretched, height of the picture.
* Width - The native, unstretched, width of the picture.
* Graphic - The TGraphic object contained by the TPicture
* Bitmap - Returns a bitmap. If the contents is not already a bitmap, the contents are thrown away and a blank bitmap is returned.
* Pixmap - Returns a pixmap. If the contents is not already a pixmap, the contents are thrown away and a blank pixmap is returned.
* PNG - Returns a png. If the contents is not already a png, the contents are thrown away and a blank png ( TPortableNetworkGraphic) is returned.
* PNM - Returns a pnm. If the contents is not already a pnm, the contents are thrown away and a blank pnm ( TPortableAnyMapGraphic) is returned.
* Jpeg - Returns a jpeg. If the contents is not already a jpeg, the contents are thrown away and a blank jpeg ( TJPegImage) is returned.

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