Graal Forums  

Go Back   Graal Forums > Development Forums > Tech Support
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-08-2003, 07:45 PM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Changeimgzoom bug

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
Attached Files
File Type: nw bug.nw (9.4 KB, 234 views)
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:00 AM.


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