Saves graphic image data to a stream using the specified format and file extension.
Source position: graphics.pp line 927
public procedure TPicture.SaveToStreamWithFileExt( |
Stream: TStream; |
const FileExt: string |
); |
Stream |
|
Stream instance where the image data for the picture is stored. |
FileExt |
|
File extension for the format used to write image data to the specified stream. |
SaveToStreamWithFileExt is a method used to store image data found in the Graphic property to the TStream instance specified in Stream. It ensures that supported TGraphicClass class types in Graphic are handled properly when accessing and storing the image data.
No actions are performed in the method if the Graphic property has not been assigned (contains Nil).
FileExt is the file extension for the graphics class used to write the image data to the specified stream. It can differ from the format used in Graphics, and can contain any of the graphics classes supported in the LCL implementation. It must include the '.' separator for the file extension. For example: '.jpg', '.png', or '.ico'.
The FindGraphicClassWithFileExt method is used to get a graphic class when a file extension has been provided in FileExt. An EInvalidGraphic exception is raised if FileExt contains an invalid graphics format for the current platform.
When FileExt is omitted, or contains the same extension used in Graphic, the SaveToStream method in the TGraphic instance is called to store the image data. No conversion is needed for the values written to Stream.
SaveToStreamWithFileExt provides support for conversion of image data for TFPImageBitmap descendants using their GetWriterClass methods. The raw image data is accessed and stored to Stream using the SaveToStream method found in the writer class.
If Graphic is derived from TCustomIcon, support is provided for converting the current icon image in Graphic to the specified file extension. The TCustomIcon.ExportImage method is used to write the icon image data.
An Exception is raised if Graphic does not support conversion to the file extension specified in the FileExt argument.
Modified in LCL version 4.2 to save individual images in TCustomIcon to another raster image format.
|
Graphic - The TGraphic object contained by the TPicture. |
|
|
Finds a graphic class with the named file extension Ext, and raises an exception if not found. |
|
|
TCustomIcon - base class for TIcon. |
|
|
Exports the image for the icon at the specified index to another TFPImageBitmap class instance. |
|
|
Ordinal position for the current image displayed for the icon. |
|
|
Implements a Bitmap using the FPImage reader and writer from the FCL. |
|
|
TGraphicClass - class of TGraphic. |
| Version 4.4 | Generated 2025-11-08 | Home |