[AD] fixed and float (was: RE: [AD] Faster hsv_to_rgb())

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


>> Also, most of the Allegro functions that use floats have equivalent
>> functions that use fixed-point numbers, but the RGB<->HSV functions do
>> not. Should there be? The problem is that in Allegro, all functions with
>> fixed and float have float-versions with _f whereas the fixed versions
>> have no such postfix. If we re-name the existing RGB<->HSV functions so
>> they are rgb_to_hsv_f() and hsv_to_rgb_f() and write fixed-point versions
>> using the original names, it would break the API as programs
>would have to
>> be re-written to call the _f versions instead or use fixed-point numbers.
>> The alternative is to post-fix the fixed-point version with _f but then,
>> it would create an inconsistency in the API which is a bad thing. Or
>> perhaps the fixed point versions could be postfixed with _fixed. If it is
>> decided that there should be fixed-point equivalents, I'll volonteer to
>> write them.
>
>Thanks, but I don't think they are worth your time, at least as far as
>Allegro is concerned. I suspect that rgb_to_hsv_f() and hsv_to_rgb_f() are
>very little used, so they probably don't need to be seconded by functions
>that would be even less used.

They won't take me long to write so I could easily submit them. In fact, I'm
already using a variation of a fixed-point version of hsv_to_rgb() in a
program I'm working on. Another idea I had for the naming would be to
depreciate "hsv_to_rgb()" to "hsv_2_rgb_f()" and create a new fixed-point
"hsv_2_rgb()".

Incidentally, Criterion's Renderware API uses a type called "real" which is
typedef'd as either fixed or float depending on whether fixed-point or
floating-point arithmetic is faster on the current platform. Arithmetical
operations are done using macros that expand to the correct way of doing the
operations depending on whether 'real' is typedef'd as fixed or float.
Perhaps this could be a suggestion for Allegro 5. That way, we would only
need one version of each function rather than a separate fixed and float
version of any function that uses real-numbers (ie. non-integers).

AE.





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