Herd Software Development
DaVinci Graphics Library
DaVinci Documentation
Some useful background on TImage
As virtually all longtime Delphi users are painfully aware, the TImage originally supplied with Delphi 1.0 proved to be severely limited in terms of its capabilities. It was effectively limited to image display. Let's face it...even with the improvements made in Delphi 3 and 4, it still leaves even casual developers hungry for more flexibility and power.
TDavinci, the DaVinci interface component for Delphi, may not solve all your problems. But it can add a great deal of depth to the image-handling capabilities of virtually all applications without dramatically increasing the complexity of your code. If any of the following problems is a concern with your application, then the extra overhead of DaVinci might be well worth the solutions it provides.
What's buggy
-
Delphi 1 only: Improper palette control when 256 color images were displayed using 256 color display drivers often corrupted the image's palette when the image was displayed.
-
Delphi 1 and 2: The TForm.Print method mishandles printing of 256 color images at 8 bit display depth, often resulting in unintelligible output on non-color printers. Can be solved by DaVinci using DitherTo4 or ConvertDIB to less than 256 colours.
-
Delphi 1 and 2: TBitmap discards the bitmap's biXPelsPerMeter and biYPelsPerMeter properties on load, meaning that dots-per-inch resolution information always defaults to the screen resolution.
What's missing and what's missed
-
The TForm.Print method uses the same method normally used for screen shots, reducing all graphic data on the form, including TImage components, to the screen's resolution (usually, 96 dpi). This has given Delphi a reputation for producing ugly image printouts both with bitmaps and metafiles. This particular problem can be solved by the creating the printer object with Printer.StartDoc in place of TForm.Print, and outputting the form or component's canvas to Printer.Canvas using Picture.StretchDraw.
-
Delphi 1 only: TImage converts all loaded images to DDBs, regardless of whether the object is visible on a form. This results in unnecessarily high memory requirements for images in memory whose bit depths are lower than those of the current video driver. In effect, a 16 color bitmap on an 8 bit display requires the same memory as a 256 color image. This deficiency becomes positively crippling when you consider the requirements of a large monochrome image, such as a scan, on a TrueColor display. The memory requirements for such an image effectively become multiplied by 24. This particular problem can be solved using BitmapFromDIB, as demonstrated how in the DAVDELPH sample program.
-
Beginning with Delphi 2, support for standard metafiles was dropped. TImage 32 bit supports only the enhanced metafile format (EMF). Any applications making extensive use of vector based graphics will require extensive duplication of effort in order to support both Win16 and Win32 deployment.
-
TJPEGImage. Need we say more? Seriously, developers have been complaining since its first appearance in Delphi 2.01 about its lack of functionality and particularly its inability to output JPEG-compressed back images to disk. The component has improved with Delphi 3 and 4, but it's still pretty limited, especially considering the enormous number of popular Delphi-based web authoring apps on the market. DaVinci supports all popular JPEG formats, has been tuned and optimized over several years, and also writes JPEGs to disk with control over image quality.
What was never there
-
As virtually all Delphi developers inevitably discover, TrueColor images on 8 bit displays paint very slowly and rarely to good effect. TImage doesn't even implement Windows' own diffusion capabilities to create something halfway pleasing to the eye. The result has been a slew of hacks and workarounds, some going as far as binding two copies of an image into resources, one for 8 bit displays and one for HiColor/TrueColor. A simple solution is provided with the DitherTo8 function demonstrated in DAVDELPH, which applies a high-quality color reduction to TrueColor DIBs in memory.
-
TImage does not offer Scrollbars if the image is bigger than the TImage component. When activating the "stretch" function, the aspect ratio between height and width of the picture is lost.
Using DaVinci with TImage