You are not logged in.

#1 2009-10-28 17:16:25

michelinux
Member

[RESOLVED] Strange behavior in GRRLIB_DrawImg

Scaling images with GRRLIB_DrawImg has strange effects on images position... I spend a lot of time understandig what follows.

Suppose you have an image 64x64 pixel if you do:
GRRLIB_DrawImg(320, 240, image, 0, -1, -1, WHITE);
the image will be displayed in the area (257,177)-(320,240): in this case (x,y) is the bottom right corner of the image hmm

If you do:
GRRLIB_DrawImg(320, 240, image, 0, -1, 1, WHITE);
happens the same as above

If you do:
GRRLIB_DrawImg(320, 240, image, 0, 1, -1, WHITE);
the display area becomes (320,240)-(383,303)

If you do:
GRRLIB_DrawImg(320, 240, image, 0, 1, 0.5, WHITE);
the image will be displayed in the area (320,272)-(383,303): in this case (x,y) is not a corner of the image hmm

I don't know if this behaviors are intentional or not, but it would be much easier for us if (x,y) were always the top left of the image

Last edited by michelinux (2009-10-28 17:20:58)

Offline

 

#2 2009-10-30 06:06:13

spack
Member

Re: [RESOLVED] Strange behavior in GRRLIB_DrawImg

I encountered the same problem this morning.  I think it's a typo in the functions GRRLIB_DrawImg and GRRLIB_DrawTile within "GRRLIB_render.c".  On lines 75 and 210, replacing "scaleX" with "scaleY" seems to correct the problem.

Offline

 

#3 2009-10-30 06:57:19

Crayon
Bad Mother Fucker

Re: [RESOLVED] Strange behavior in GRRLIB_DrawImg

spack, I reported that problem to the other authors of GRRLIB because I did not code that part. Sadly I never got any answer.

If you say it fixes the problem, I will change the code in the repository.

Thanks for your help,

Crayon

Offline

 

Board footer

Powered by FluxBB