[Gambas-user] gb3: Draw method with same source and destination image

Benoît Minisini gambas at ...1...
Thu Feb 3 01:00:07 CET 2011


> On 02/02/2011 02:11 PM, Kevin Fishburne wrote:
> > I have an image, blandscape, that is 1408 x 1408 pixels. This code works:
> > 
> > blandscape.Draw(blandscape, 0, -128)
> > 
> > This code produces odd results (attached):
> > 
> > blandscape.Draw(blandscape, 0, 128)
> > 
> > I'm trying to shift the image in any of eight directions (up, down,
> > left, right, up-left, up-right, down-left, down-right) by 128 pixels,
> > which is the size of the "tiles" used in the game. I'm basically
> > copying the image onto itself but offset by 128 pixels. Any idea
> > what's going on here? I tried using all the available parameters for
> > the Draw method and it still didn't work.
> 
> I think I figured it out. It looks like the Draw method doesn't create a
> "temporary" image to do the copying, meaning it's literally writing over
> itself in memory. I worked around the issue by using a temporary image,
> though it is slower. I don't think the Draw method should be changed, as
> it is more efficient this way. Having it automatically create a
> temporary image when the source and target are the same would really
> slow things down if it wasn't needed.

Actually you want some sort of scrolling?

-- 
Benoît Minisini




More information about the User mailing list