ok i'm trying to up to 1.6 :') not so bad isn't it ?
i've seen that the line function has changed to some FP stuff, well.
i try to draw a very simple thing like
- Code:
line( 10, 10, 50, 50, 0xFF);
hu doesn't work ?!? have you had such problems ? or do i have to do something more to init some stuff ? (i mean more than in the previous EasyCE)
i think the getbuffer() is ok because Hline, Vline, plot ... works well, only line issues...
thx
Hi,
The line function expects to get fixed point numbers so you have to convert your ints like this:
- Code:
line(IFP(10), IFP(10), IFP(50), IFP(50), 0xFF);
And that should work.
Pam
oh oh ! i've seen int values in the header !?!??
anyway, i try (without really understanding)
thanks !
The fixed point numbers are actually stored as ints, they just have a different meaning. That's why they show up as ints in the headers.
BTW, the line, line_x and line_a functions are the only functions that use fixed-point.
ok thx !! i've read again the line function and understood.
i have to understand now why i got some clipping: the line won't draw in a band located under y=239 (i mean from y=240 to y=319) ie if i draw a line from (0,0) to (239,319) it starts well, go down to where y=239 and then stops.
argh i swapped 240 with 320 in the line function of EasyCE.cpp that gives:
- Code:
void line( int x1, int y1, int x2, int y2, PIXEL color )
{
if (y1>y2)
{
int h=y1;
y1=y2, y2=h;
h=x1, x1=x2, x2=h;
}
int dx, dy, len = abs( x2-x1 );
if (abs( y2 - y1 ) > len) len = abs( y2 - y1 );
len = len >> FPP;
if (len != 0)
{
dx = (x2 - x1) / len;
dy = (y2 - y1) / len;
}
if (y1 < 0)
{
if (dy > 0)
{
int i = -(y1 / dy) + 1;
x1 += dx * i;
y1 += dy * i;
len -= i;
}
else len = 0;
}
if (len > 0) if (x1 < 0)
{
if (dx > 0)
{
int i = -(x1 / dx) + 1;
x1 += dx * i;
y1 += dy * i;
len -= i;
}
else len = 0;
}
if (len > 0) if (y2 > (320 << FPP))
{
if (dy > 0)
{
int i = ((y2 - (320 << FPP)) / dy) + 1;
x2 -= dx * i;
y2 -= dy * i;
len -= i;
}
else len = 0;
}
if (len > 0) if (x2 > (240 << FPP))
{
if (dx > 0)
{
int i = ((x2 - (240 << FPP)) / dx) + 1;
x2 -= dx * i;
y2 -= dy * i;
len -= i;
}
else len = 0;
}
for ( int i = 0; i < len + 1; i++)
{
buffer[((y1 >> FPP) * 240) + (x1 >> FPP)] = color;
x1 += dx;
y1 += dy;
}
}
it works now, but i don't like to change these sources
what do ya think ?
That brings me to SCRWIDTH and SCRHEIGHT wich should be found in any sub drawing pixels no ?
huhu so much things i don't understand ...
ie: if we define LANDSCAPE in easyce.h, i don't understand how the plot function will do the job...
lights ?
Actually, if you define LANDSCAPE, the only thing that will change is SCRWIDTH and SCRHEIGHT. (actually, on the pc it will also display sideways, but on PPCs nothing else will change)
I have rewritten a couple parts of EasyCE to fix this (the only thing it hasn't fixed is the blit to video memory, that is only changed on the iPAQ 38xx (that's what I have, and I haven't made anything that I want to run on anything else, so I haven't fixed it (I wouldn't be able to test it anyway))). It should be trivial to fix.
I can send you the file, it also has faster versions of all the graphics functions, a bresenham based line function that uses integers (no IFP(x) nescessary), and another line function that performs clipping (only the line function does this, for everything else clipping is trivial, so it is best done in your application, lines it is more complicated). I also added a couple other things (floating point emulation of fixed point (that seems like an oxymoron of sorts), a few additional input functions, a built-in sine/cosine table (uses fixed point), and some blending stuff).
Anyway, If you (or anyone else) want(s) it, just send me an email.
hmmm i've tried to mail to u, not sure this to work... could you please send me a copy to:
wb@wanadoo.fr
thanks !!!
Lewil: I haven't checked my email in a few days (mail server problems). I just got your email and sent you a reply.