[Lazarus] Graphics changes (r15472)

Luiz Americo Pereira Camara luizmed at oi.com.br
Fri Jun 20 04:44:33 CEST 2008


Marc Weustink wrote:
> Hi,
>
> Today i've committed a few graphics changes which might effect existing 
> applications.
>
> 1) TBitmap is splitup into 4 separate classes:
>
> TRasterImage (TGraphic)
>   A mostly virtual baseclass which has a Canvas and the capability
>   of displaying itslef through a BitmapHandle.
>
> TCustomBitmap (TRasterImage)
>   A baseclass for rasterimages with one image
>
> TFPImageBitmap (TCustomBitmap)
>   A base class for images which get loaded and saved with the help
>   of FPImage. Most image formats lazarus supports are read this way
>
> TBitmap, TPixmap, TPNGImage.... (TFPImageBitmap)
>   Implementations of the specific graphic formats. Most define
>   only a reader and a writer.
>   

One old issue i have with TBitmap (not introduced now but that could be 
resolved with this refactoring) is that when a image is loaded with 
LoadFromStream or
LoadFromFile a copy of the image buffer is kept in memory. This can 
speedup if is necessary to access the image data directly but for the 
more common case
of loading a file to display is waste of memory.

There's also another problem with it: if the image is modified using 
LCLIntf functions like BitBlt the buffer will not be updated and next 
time SaveToFile/Stream is
called, the buffer (with the outdated data) will be used.

Maybe a TBufferedImage class or an option can be added.

Luiz



More information about the Lazarus mailing list