[Gambas-user] gb3: Draw method with same source and destination image
Kevin Fishburne
kevinfishburne at ...1887...
Thu Feb 3 00:45: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.
--
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271
More information about the User
mailing list