JVCL Help:TJvDBImage

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Class Hierarchy

TJvDBImage
TJvDynControlJVCLDBImage
run\JvDBImage.pas


Summary

This component is a TDBImage replacement that supports other image formats than bitmap, a limitation of TDBImage since D1.

run\JvDBImage.pas


Pascal

 run\JvDBImage.pas
 TJvDBImage = class(TDBImage);


Description

  1. JVCLInfo

IMAGE FORMATS: The implementation is simple: Just register image signatures with RegisterGraphicSignature procedure and the component takes care of the correct instantiation of the TGraphic object. The signatures register at unit's initialization are: BMP, WMF, EMF, ICO, JPG. If you got some other image library (such as GIF, PCX, TIFF, ANI or PNG), just register the signature:
RegisterGraphicSignature(<string value>, <offset>, <class>)
or
RegisterGraphicSignature([<byte values>], <offset>, <class>)
This means: When <string value> (or byte values) found at <offset> the graphic class to use is <class>.
For example (actual code of the initialization section):
RegisterGraphicSignature([$D7, $CD], 0, TMetafile); // WMF

  RegisterGraphicSignature([0, 1], 0, TMetafile);     // EMF
RegisterGraphicSignature('JFIF', 6, TJPEGImage);

You can also unregister signature. IF you want use TGIFImage instead of TJvGIFImage, you can unregister with:
UnregisterGraphicSignature('GIF', 0);
or just
UnregisterGraphicSignature(TJvGIFImage); // must add JvGIF unit in uses clause
then: RegisterGraphicSignature('GIF', 0, TGIFImage); // must add GIFImage to uses clause
If you don't like the signature registration there is a new event called OnGetGraphicClass. The event gets the following parameters:
Sender: TObject;

 Stream: TMemoryStream;
var GraphicClass: TGraphicClass)

The memory stream containing the blob data is sent in Stream to allow the user to inspect the contents and figure out which graphic class is.
If the component can't find the graphic class and the user doesn't provide it in the OnGetGraphicClass event no graphic object is created, the default behavior is used (Picture.Assign(Field)). This might raise an exception ('Bitmap image is not valid').
The graphic class to be used must implement LoadFromStream and SaveToStream methods in order to work properly.
SUPPORT FOR TDBCtrlGrid: You can safely put a TJvDBImage in TDBCtrlGrid.

run\JvDBImage.pas


About

Navigation

run\JvDBImage.pas



Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page