Re: [AD] float positions

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2007-01-22 at 14:34 -0300, Victor wrote:

> Many programs assume that pixels are integers. E.g:
> 
> // Changes yellow to blue in some bitmap.
> int x, y, color;
> for (x = 0; x < bmp->h; x++) {
>     for (y = 0; y < bmp->w; y++)
>         color = getpixel(bmp, x, y);
>         if (color == makecol(255, 255, 0))
>             putpixel(bmp, x, y, makecol(255, 255, 0));
>     }
> }
> 
> If pixels aren't integers, things like that may fail or bug.

As long as int -> float -> int conversion returns the same int, it
should keep working. So unless you create a 2000000 x 2000000 bitmap,
there won't be a problem.

> > > It would be better to create new functions to put/get non-integer
> > > pixels and use non-integer blit, without deprecating or changing
> > the
> > > existing ones. Its important to note that they don't need to use
> > > OpenGL, it's feasible and not very complex to implement they by
> > hand
> > > _IF_ needed for whatever reason.
> > 
> > There are no existing ones as it is yet to be written..
> > 
> 
> I am not sure if I am misunderstanding what you are talking about or if
> you went nuts. What about putpixel, getpixel, blit, line, hline, vline,
> polygon, circle, masked_blit, draw_sprite, rotate_sprite, floodfill,
> and many, many others which indeed exists for a long time ago?
> 

Yes, I was talking about the GFX API proposal though.. none of its
functions (e.g. al_line) are implemented yet, so if the first
implementation is with floats, it has floats. The 4.2 functions have
nothing to do with it (and the compatibility layer should not have much
problems passing the ints from line() to al_line() either).

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/