Board index » delphi » Tiled Images - One More Time

Tiled Images - One More Time

Just wondering how others have managed images which are composed of
multiple bitmaps.  Do you read each bitmap in separately then copy
into the correct spot in the output image with CopyRect or Draw?  Is
there a way to load bitmaps directly into the correct spot in the
output bitmap without the need to perform a CopyRect.

TIA.

 

Re:Tiled Images - One More Time


Quote
In article <3C72E185.23ED9...@courthouse.com>, Sue D. Nom wrote:
> Just wondering how others have managed images which are composed of
> multiple bitmaps.  Do you read each bitmap in separately then copy
> into the correct spot in the output image with CopyRect or Draw?  Is
> there a way to load bitmaps directly into the correct spot in the
> output bitmap without the need to perform a CopyRect.

I've used a mixture of both at one time or another.

Method 1) Store file name and destination rect in a structure and
iterate through in a refresh LoadFromFile(..) StretchDraw(DestRect).
It's surprisingly quick (not quick enough for any sort of animation I
would suspect) but probably depends on the size of the images.

The disadvantage of 1 being it isn't user friendly to move images
about, not easily anyway.

Method 2) Hold an array or List of TPicture and destination rect then
with List[index] do StretchDraw(DestRect). (List could have a method
Draw(index))

Disadvantage of 2 being resources. The advantage being it's easier to
implement a 'drag rect'.

If you want to see both methods in action try
http://www.mgcsoft.com/programs/mgceq612.zip (about 1.7Mb). Method 1
is somewhat hidden as it's just retained for backward compatability.
If you can't find how to do it just mail me.

Gordon

Re:Tiled Images - One More Time


I use yet another mixture to hold my thumbnails:

A list which is in memory holding JPG compressed images. This reduces
enormously the memory requirements. Once needed, you decompress the images
from memory and blt or draw them to the screen. This reduces time because
the file holding the thumbnail does not have to be accessed.

Note that with this method you get some lossy effects, esp. if you set the
quality factor too low. You could also just use a lossless compression
stream with bitmaps, I have that as an option. But this saves only 60% of
memory, and still causes quite some overhead with the decompression
algorithm.

This is just a simplified description - the real code also implements a
backing store - thumbnails are stored on disk when not used for a while and
the total list gets too long.

Nils
www.abc-view.com

Quote
Gordon Whittam <gor...@mgcsoft.com> wrote in message

news:VA.00000042.0038998b@mgcsoft.com...
Quote
> In article <3C72E185.23ED9...@courthouse.com>, Sue D. Nom wrote:
> > Just wondering how others have managed images which are composed of
> > multiple bitmaps.  Do you read each bitmap in separately then copy
> > into the correct spot in the output image with CopyRect or Draw?  Is
> > there a way to load bitmaps directly into the correct spot in the
> > output bitmap without the need to perform a CopyRect.

> I've used a mixture of both at one time or another.

> Method 1) Store file name and destination rect in a structure and
> iterate through in a refresh LoadFromFile(..) StretchDraw(DestRect).
> It's surprisingly quick (not quick enough for any sort of animation I
> would suspect) but probably depends on the size of the images.

> The disadvantage of 1 being it isn't user friendly to move images
> about, not easily anyway.

> Method 2) Hold an array or List of TPicture and destination rect then
> with List[index] do StretchDraw(DestRect). (List could have a method
> Draw(index))

> Disadvantage of 2 being resources. The advantage being it's easier to
> implement a 'drag rect'.

> If you want to see both methods in action try
> http://www.mgcsoft.com/programs/mgceq612.zip (about 1.7Mb). Method 1
> is somewhat hidden as it's just retained for backward compatability.
> If you can't find how to do it just mail me.

> Gordon

Other Threads