[lazarus] started porting Delphi PNG unit to FPC/Lazarus

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jun 30 12:38:16 EDT 2003


On Mon, 30 Jun 2003 18:46:39 +0200
"Stefan Weber" <w-e-b-e-r at web.de> wrote:

> Matthias wrote:

Who?

 
> > The FCL will support device/platform independent graphics.
> ok.
> 
> > The LCL will support device/platform dependent graphics.
> Do you mean gtk/gtk2/qt/win32/... specific?

Yes. 
The TBitmap.Handle with the gtk interface will be a pgdkimage, while with
the win32 interface is a HBITMAP. 


> > I think, speed is very important and so we need the possibility to load
> > graphics with less mappings/conversions as possible. For instance an
> > image should not be loaded with calls to SetPixel.
> Of course not.
> 
> > And I guess, we can't simply
> > emulate the VCL and their win32 bitmaps. 
> 
> I think it would make sense to have a TDIB (device independent bitmap)
> that stores images as RGB(+Alpha) arrays with 24bit depth and a DPI 
> setting to start with. 
> 
> This could later be extented to support 1bit, 8bit and other depths. 
> Palette formats are not so important these days.
> 
> The TDIB would go in the FCL as well as low level image file format
> implentations like BMP, XPM, PNG, JPG, TIFF, GIF, ... whatever. 
> 
> It would be nice to be able to plug-in image format implementations
> so that for example one could have PNG via libpng or via native Pascal 
> implementation.
> 
> They should descent from a common abstract image class like TGraphic.
> This would require TGraphic to be moved to the FCL.
> 
> All image format implementations must be able to assign from/to the
> TDIB format performing conversion if necessary.
> 
> Maybe for the LCL TDIB could be integrated with TBitmapImage in
> order to be able to share DIB's amoung several components?
> 
> Device dependent bitmaps are only useful to save memory and
> provide for fast GUI redrawing on non-true-color-displays, 
> aren't they?

- Device dependent images are the only ones that can be used on screen. The
DI images are "only" a goody to do in memory graphic manipulations.
- Using the device dependent drawing functions make use of the hardware
accelerations. DI can not use them.
- DI are important for file formats and applications wthout a GUI (e.g.
cgi).

So, we need both. The DD images are more important for the LCL, while the DI
images are more important for the FCL.


Some notes:

Michael VC committed today the start of fpimage, the base units for device
independent images. They are in an early state, but they can already
load/save simple xpm/png files. Checkout the new fcl and have a look. You
will find many of your ideas already implemented.
I'm currently improving the LCL to create the connection.


Mattias






More information about the Lazarus mailing list