开发者

Customizing LibTIFF with various callback functions / event listeners

From reading the LibTIFF source code, it appears to me that the main approach to customizing LibTIFF is to define new Tags and to implement new Codecs. Also, since LibTIFF is open-source and has a liberal license, users who need to tweak it for various purposes can modify it directly.

However, there is a kind of customization which doesn't seem to fit into the two approaches to e开发者_运维问答xtension: I want to install various kinds of event listeners (callback functions) so that I can detect various conditions that happen inside the existing codecs.

Example #1: I want to be able to replace the error / warning message handlers of LibTIFF so that it is thread-safe and sends the messages to a callback function set by the caller.

Example #2: Some TIFF images may be missing some tags, and LibTIFF tries to make them up by guessing their values. Sometimes some tags are obviously wrong and LibTIFF tries to correct them. However, I would like to have a callback function which is notified whenever LibTIFF changes the tag's value, so that I can log this and generate a report about the image's conformance to the standard.

Example #3: I need to concatenate several pages of a multi-page TIFF together. The pages have the same dimensions and compression parameters. If I have access to the compressed data, then I can do this more efficiently by copying the compressed data verbatim into the strips of a new TIFF image.

What is the recommended way of adding callback functions / event listeners to LibTIFF, without complicating its architecture?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜