TGraphic class
Abstract base class used for images in supported image formats.
Declaration
TGraphic = class(TPersistent)Inheritance
- TGraphic
- TPersistent
- TObject
Descends from it: TRasterImage
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:
- LoadFromFile
- LoadFromStream
- LoadFromMimeStream
- LoadFromLazarusResource
- LoadFromResourceName
- LoadFromResourceID
- LoadFromClipboardFormat
- LoadFromClipboardFormatID
- SaveToFile
- SaveToStream
- SaveToClipboardFormat
- SaveToClipboardFormatID
- GetSupportedSourceMimeTypes
- GetResourceType
- GetFileExtensions
- IsStreamFormatSupported
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:
- Height
- Width
- Modified
- Empty
- MimeType
- Palette
- PaletteModified
- Transparent
Event handlers are provided for change and progress notifications, including:
- OnChange
- OnProgress
TGraphic is the type used to implement the Graphic property in TPicture, and passed as an argument to methods in TCanvas.
See also
Properties
Empty | public | Indicates if the graphic is empty (contains no data). |
Height | public | The native, unstretched height for the graphic. |
Modified | public | Indicates if the graphic data in the class instance has been modified. |
MimeType | public | MimeType - the MIME type of the graphic. |
Palette | public | Handle to the color palette used in image data. |
PaletteModified | public | Indicates whether the palette of colors been modified. |
Transparent | public | Indicates whether some parts of the image are not opaque. |
Width | public | Width - The native, unstretched, width of the graphic. |
Methods
Changed | protected | Performs action needed when the image data has changed. |
Equals | protected | Determines if the specified class instance is the same as the current class instance. |
DefineProperties | protected | DefineProperties finds out whether the object really is a binary (graphic). |
Draw | protected | Method used to draw the Graphic on the specified Canvas, in the specified Rectangle. |
GetEmpty | protected | Gets the value for the Empty property. |
GetHeight | protected | Gets the value for the Height property. |
GetMimeType | protected | Gets the value for the MimeType property. |
GetPalette | protected | Gets the value for the Palette property. |
GetTransparent | protected | Gets the value for the Transparent property. |
GetWidth | protected | Gets the value for the Width property. |
Progress | protected | Monitor the Progress of the drawing. |
ReadData | protected | ReadData - reads data for the Graphic from a stream. |
SetHeight | protected | Sets the value for the Height Property. |
SetPalette | protected | Sets the value for the Palette property. |
SetTransparent | protected | Sets the value for the Transparent property. |
SetWidth | protected | Sets the value for the Width property. |
SetModified | protected | Sets the value for the Modified property. |
WriteData | protected | Writes the data for the Graphic to a stream. |
Assign | public | Implements object persistence for the TGraphic type. |
Create | public | Constructor for the class instance. |
Clear | public | Clear has an empty implementation in TGraphic. |
LazarusResourceTypeValid | public | Determines if the specified resource type is valid for the image format. |
LoadFromFile | public | Reads data for the graphic from a file. |
LoadFromStream | public | Reads graphic data from a stream. |
LoadFromMimeStream | public | Loads the from the specified stream for the given MIME type. |
LoadFromLazarusResource | public | Load the graphic data from a Lazarus Resource (.lrs) file. |
LoadFromResourceName | public | Loads a resource with the specified name from the given handle. |
LoadFromResourceID | public | Loads graphic data from a resource identified by the integer identifier ResID. |
LoadFromClipboardFormat | public | LoadFromClipboardFormat - Replace the current image with the contents of the clipboard. |
LoadFromClipboardFormatID | public | Load the data from the clipboard using the format type specified by ClipboardType and the format identifier FormatID. |
SaveToFile | public | Writes graphic data to the specified file name. |
SaveToStream | public | SaveToStream - write graphic data to a stream. |
SaveToClipboardFormat | public | SaveToClipboardFormats - Converts the image to a clipboard format. |
SaveToClipboardFormatID | public | Saves the data to a clipboard of Type ClipboardType using the format FormatID. |
GetSupportedSourceMimeTypes | public | Gets a list of supported MIME types for data used in the graphic. |
GetResourceType | public | Gets the Integer Resource Type for the class instance. |
GetFileExtensions | public | Returns a list of the file extensions available. |
IsStreamFormatSupported | public | Indicates whether the specified stream type is supported in the class. |
Events
OnChange | public | Event handler signalled when data in the class instance is changed. |
OnProgress | public | Event handler signalled to track the progress of operations in the class instance. |
Inherited
From TPersistent (7)
AssignTo Destroy FPOAttachObserver FPODetachObserver FPONotifyObservers GetNamePath GetOwner
From TObject (39)
AfterConstruction BeforeDestruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName SafeCallException StringMessageTable SystemHasExtendedRTTI ToString UnitName
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
