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

TCustomIcon.ReadStream

Reads the content for the icon from the specified stream.

Declaration

Source position: graphics.pp line 1644

protected procedure TCustomIcon.ReadStream(

  AStream: TMemoryStream;

  ASize: LongInt

); override;

Arguments

AStream

  

Stream instance with the image content read in the method.

ASize

  

Number of bytes expected for the icon data.

Description

ReadStream is an overridden procedure used to read the content for the icon from the stream specified in AStream. ReadStream implements the abstract virtual method defined in the ancestor class.

ReadStream verifies that AStream contains an icon image by checking for header value(s) that are valid for .ICO data. If the header values are not found, an EInvalidGraphic exception is raised.

For icon data, the icon directory must be read from the stream. The header contains the number of icon directory entries included in the stream. The icon directory entries are read from AStream, and include values for each icon image that includes:

ReadStream positions the stream, and reads image data for the each of the icon directory entries. It handles both DIB Bitmap and PNG (used in Windows Vista) image data for the icon images. An FCL-compatible image reader is created as required for the image type, and a TLazIntfImage instance is used to capture the raw image data from the stream. Images read from the stream are added to the internal list of images in the TSharedIcon member for the class instance.

ReadStream calls CheckRequestedSize to use the Width and/or Height specified in the class instance. GetBestIndexForSize is called to determine the value in Current with the requested image size.

See also

TRasterImage.ReadStream

  

ReadStream - loads image data into the raw image.


Version 3.2 Generated 2024-02-25 Home