[futurebasic] Re: [FB] Faster access to pictures

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Thu, 24 Apr 2008 19:23:32 +1200
Markus Binder wrote:

> today I would like to ask if there is a easy but faster way to get  
> pictures from a pict resource onto the screen. I am using this lines  
> at the moment which are a bit slow I think:
>
> Resources "boulder.rsr"
> DIM PictH as ..Picture
> Picture (x,y)-(x2,y2), fn GetResource(_"PICT",id)
>
> When I display 19 x 11 pictures, each 32 x 32 pixels with 16 bit  
> color I get 18 fps with my MacBook. That´s bad I think. What may I  
> am doing wrong? When I use 32 x 32 pictueres with each 32 bit color  
> the fps drop dramatically down and get unuseable for anything.

For each of your pictures, create a GWorld and draw the PICT resource  
into it. Use CopyBits() to draw the GWorlds to your window.

CopyBits( # fn GetPortBitMapForCopyBits( theGW ), # fn  
GetPortBitMapForCopyBits( theWindowPort ), sourceRect, destRect,  
_srcCopy, 0 )

If sourceRect and destRect are the same size (i.e. same width and  
height), CopyBits is extremely fast.

Robert P.