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

# TBitmap.LoadFromStream

Loads image data for the bitmap from the specified stream.

## Declaration

Source position: graphics.pp line 1477

`public procedure TBitmap.LoadFromStream(`
`AStream: TStream;`
`ASize: Cardinal`
`); override;`

## Arguments

`AStream` |  | Stream instance with the image data loaded in the method.
`ASize` |  | Number of bytes to read from the stream.

## Description

LoadFromStream is an overridden method used to read data for the bitmap image from the TStream instance specified in AStream. ASize contains the number of bytes to read in the method.

The inherited method has been adapted for reading from a TResourceStream instance which can contain data as RT_BITMAP or RT_RCDATA resource types having slightly different binary structures.

LoadFromStream is called when the ReadData method is executed (in the TRasterImage ancestor) or when a TBitmap instance calls LoadFromResourceName or LoadFromResourceID.

## Version info

Modified in LCL version 3.0 to provide support for loading image data from a resource stream containing either the RT_RCDATA or RT_BITMAP resource types.

## See also

TRasterImage.LoadFromStream |  | LoadFromStream - loads data for the image from a specified data stream, optionally supplying its size.
TRasterImage.ReadData |  | Reads image data during component streaming.
TGraphic.LoadFromResourceName |  | Loads a resource with the specified name from the given handle.
TGraphic.LoadFromResourceID |  | Loads graphic data from a resource identified by the integer identifier ResID.
TBitmapFileHeader |  |
TResourceType |  | Platform-specific alias for resource type identifiers in LCL.
RT_BITMAP |  | Identifier for a Bitmap resource type.
RT_RCDATA |  | Identifier for an Application-defined resource type (raw data).
TResourceStream