realbasic-betas.mbox
[Top] [All Lists]

Re: Tile window background?

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: Tile window background?
From: George Clark <gaclark at sprynet dot com>
Date: Sat, 29 Jun 2002 11:34:55 -0400
Yes, it's a lot of memory, but Richard's original request also specified
that he wanted a minimum of flickering...using the BackDrop property
accomplishes that nicely.


George


On 6/29/02 11:27, Jörg Pressel wrote:

> on 29.06.2002 16:37 Uhr, Jon Johnson at jonj at realsoftware dot com wrote:
> 
>> Create a property "myBackdrop as picture"
>> 
>> in the window's open event:
>> 
>> dim x,y as integer
>> 
>> myBackdrop=newPicture(me.width,me.height,32)
>> 
>> for x = 0 to me.width-1 step sourcePicture.width
>> for y = 0 to me.height-1 step sourcePicture.height
>> myBackdrop.graphics.drawPicture sourcePicture,x,y
>> next
>> next
>> 
>> me.backdrop=myBackdrop
> 
> That's a bit overkill, because you're using plenty of memory for just a
> background picture - I think it's better to tile your graphic in the
> window.Paint event. Storing me.width - 1 and sourcePicture.width etc. into
> variables is also much faster:
> 
> dim x, y, w, h, sw, sh as integer
> 
> sw = sourcePicture.width
> sh = sourcePicture.height
> w = me.width - 1
> h = me.height - 1
> 
> for x = 0 to w step sw
>   for y = 0 to h step sh
>       g.drawpicture sourcePicture, x, y
>   next
> next
> 
> Depending on the size of your sourcePicture it should be fast enough, too..
> 



<Prev in Thread] Current Thread [Next in Thread>