About Store Forum Documentation Contact



Post Reply 
Problems with Image
Author Message
Panerox Offline
Member

Post: #1
Problems with Image
i need to display the image in its original size without dependences on screen resolution and D.aspectDisplay (). the image has a layer of transparency and it is distorted when stretching. how do i draw the image without changing its size?

i tried to convert the pixels in EE coordinate system:
Code:
Flt x = ..., y = ...;
Flt width = Flt(_Image->x()) * (D.w() * 2) / D.x();
Flt height = Flt(_Image->y()) * (D.h() * 2) / D.y();
_Image->draw(x,y, width , height);
but for some (X, Y) the image starts to stretch.
for example:
Code:
...
D.aspectDisplay(0);
D.mode(800, 600);
...
_Image->draw(0.430,0.430, width , height ); //Ok
_Image->draw(0.431,0.431, width , height ); //Bad
there is someone who encountered such a problem, how to solve it?


Attached File(s) Image(s)
       
02-27-2010 03:40 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Problems with Image
you can try rounding x y coordinates to some values, convert to Int using D.convert methods, round, then convert back to float screen coordinates

you can also disable texture filtering before drawing
D.texFilter(0);
draw..
02-27-2010 10:49 PM
Find all posts by this user Quote this message in a reply
Panerox Offline
Member

Post: #3
RE: Problems with Image
rounding helps, but not always. it is difficult to find the right values. at this affects your screen resolution and D.aspectDisplay ().
and if you want to display part of the image? a pity that such a simple operation difficult to implement.
02-28-2010 07:48 AM
Find all posts by this user Quote this message in a reply
Post Reply