[Lazarus] Recent Graphics changes...
Marc Weustink
marc at dommelstein.net
Wed Jul 9 00:23:46 CEST 2008
wile64 wrote:
>
>
> 2008/7/8 Marc Weustink <marc.weustink at cuperus.nl
> <mailto:marc.weustink at cuperus.nl>>:
>
> wile64 wrote:
> > Hi,
> >
> > I turn quickly,
> >
> > I load images like this, (size 8192x8192)
> >
> > var
> > BmpMap: TBitmap;
> > Image1: TImage;
> >
> > Begin
> > BmpMap.Width: = Map.width * Tiles.Width;
> > BmpMap.Height: = Map.height * Tiles.Height;
> > MapImage: = BmpMap.CreateIntfImage;
> > / / ... image processing
> > BmpMap.LoadFromIntfImage (MapImage);
> > Image1.Picture.Bitmap.Assign (BmpMap);
> > end;
> >
> > 1) Since the last change LoadFromIntfImage takes +/- 11 seconds,
> before
> > 1 second.
> > 2) The TImage is in a ScrollBox, the image disappears (1seconde)
> when I
> > scroll.
> >
> > Is this a problem or should be done differently now?
>
> There isn't much changed in LoadFromIntImage, but I need to lookup if
> the internal rawimage is shared correctly. In the worst case a pixelcopy
> is made, which is not necesary in this case.
>
>
> For info: I use always last SVN on XP SP2 AMD 2500+ 1Go memory
> On linux my other PC is very more speed and I see one small change
OK, implementation form LoadFromIntfImage explains.
IntfImage.CreateBitmaps(ImgHandle, ImgMaskHandle);
SetHandles(ImgHandle, ImgMaskHandle);
the rasterimage is loaded through the handles. It should be changed to
get loaded by rawimage (infimage.releaserawimage)
the rawimage is internally needed anyway and this way the handle
creation is postponed. THis might avoid some datacopies.
IIRC CreateBitmaps/SetHandles shouldn't be affected by my recent changes.
> one little optimalisation is setting the size like:
>
> BmpMap.SetSize(Map.width * Tiles.Width, Map.height * Tiles.Height);
>
>
> Thanks for this,
>
>
>
> Another optimalisation would be creating the RawImage directly and not
> through a bitmap.
>
>
> Impossible, if the image is too big there is a mistake ( Failed to
> create handles )
A bitmap has to create the handles anyway, so if it fails for a
TLazIntfImage it would for tbitmap too.
> MapImage:= TLazIntfImage.Create(Map.width * Tiles.Width, Map.height *
> Tiles.Height);
Thats what I meant.
Marc
More information about the Lazarus
mailing list