Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Changeimgzoom bug (https://forums.graalonline.com/forums/showthread.php?t=42595)

Kaimetsu 02-08-2003 07:45 PM

Changeimgzoom bug
 
1 Attachment(s)
This is a pretty weird bug, but it's not one that people are likely to encounter much. It's illustrated in the attached Graal level.

First, though, a more minor bug: I draw an image and set its zoom to 0.6. Then I later draw a different image in its place. The zoom factor stays the same despite the images changing. I suggest that the zoom should be nullified when the image changes, just like changeimgpart is nullified. Now, it's not a superbig deal because we can always explicitly change the zoom every time we draw an image. However, then we get another trouble, as the script shows:

Every 0.05 seconds, Graal puts some text on the screen at a zoom factor of 0.6. However, when you hold the space bar it also runs a small piece of code before it places the text. That code draws light2.png in the same place and sets the zoom to 1. Both use the same index, so you'd expect the text to overwrite the image as if it weren't even there.

However! Instead, the text is drawn with an offset, which is equal to (imagewidth*0.5,imageheight*0.5). I think I have something resembling an explanation:

When Graal zooms an image, it keeps a virtual centre in memory, which is actually (x+width*0.5,y+height*0.5). Then it draws the image at an offset from this point, depending on how high the zoom factor is. When we do the light2.png showimg and apply changeimgzoom to it, it calculates and stores this offset. When we switch to draw the text, it doesn't update this centre and so the text is drawn from there. Strangely, this doesn't seem to happen if the first image is drawn with a zoom factor of anything other than 1. Maybe Graal doesn't bother to update the centre if the factor is 1, because it assumes the image hasn't been zoomed? I don't know, I've done pretty much all I can without access to the source code. Now it's Stefan's turn =D


All times are GMT +2. The time now is 09:21 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.