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

TDBImage.OnDBImageRead

Event to read a custom header from image stream.

Declaration

Source position: dbctrls.pp line 1222

published property TDBImage.OnDBImageRead : TOnDBImageRead
  read FOnDBImageRead
  write FOnDBImageRead;

Description

By default, the TDbImage component expects a header at the start of the image stream. This helps to efficiently identify the image format contained in the data stream. On writing, the header is controlled by the WriteHeader property or the OnDbImageWrite event handler.

When loading image data which was created by external applications, the data stream may not have a header or the header is not a format identifier that the TDbImage component would recognize.

In this case, the OnDbImageRead event can be used to identify the image format in the data stream. In the GraphExt parameter it must return a format identifier corresponding to the registered image format. This format identifier could e.g. be read from the data stream provided in the s parameter. On return, the data stream should start with the raw image data.

If the OnDbImageRead handler was not implemented or if it returns an invalid format identifier, the TDbImage component will try to load the image by checking the data stream content. This means that it is not necessary to write an OnDbImageRead event handler for the most common image formats, For example: jpg, png, gif or bmp.

The TDbImage component will be able to identify the image format even if the data stream doesn't have a header for those TGraphic registered classes that implement the IsStreamFormatSupported method.


Version 3.2 Generated 2024-02-25 Home