TJvDBImage は、複数の画像フォーマットをサポートする優れたコンポーネントです。JvJVCLUtilsでは、RegisterGraphicSignature手続きで対応フォーマットを拡張できると記載されていました。それが言及したコメントで:
WHAT IT IS:
These are helper functions to register graphic formats than can
later be recognized from a stream, thus allowing to rely on the actual
content of a file rather than from its filename extension.
This is used in TJvDBImage and TJvImage.
IMAGE FORMATS:
The implementation is simple: Just register image signatures with
RegisterGraphicSignature procedure and the methods 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([1, 0], 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
私は命令に従い、そのユニットの uses 句に GIFImage を追加しました。また、プロシージャ GraphicSignaturesNeeded に次を追加しました。
RegisterGraphicSignature('GIF', 0, TGIFImage);
RegisterGraphicSignature([$4D, $4d, 0, $2A], 0, TWICImage); // TIFF
RegisterGraphicSignature([$49, $49, $2A, 0], 0, TWICImage); // TIFF
TIFF 情報は、ヒント: グラフィック形式の検出に基づいてい ます。
次に、makemodified.bat を使用して JVCL を再コンパイルしました。
変更前は、TJvDBImage にイメージをロードするとファイルがロードされ、「ビットマップ イメージが無効です」というエンドレス エラーが発生します。変更後、ファイルのロードを拒否し、同じエラーが 1 回発生します。
他のツールを使用して GIF / TIFF 画像をフィールドにロードすると、表示時に上記のエンドレス エラーが発生します。上記のリンク関数を使用してフィールド コンテンツをロードすると、TImage に完全に表示できます。
それで、私は何を逃したか、間違っていますか?
ありがとうございました!