comp.lang.ada
 help / color / mirror / Atom feed
* Color components and fixed point numbers
@ 2004-03-01 11:49 Pat
  2004-03-01 16:24 ` Robert I. Eachus
  0 siblings, 1 reply; 6+ messages in thread
From: Pat @ 2004-03-01 11:49 UTC (permalink / raw)


Hi,

I would like to declare two records representing a RGB Color with two
different percisions. The Small one with color components from 0..255
and the Wide one with components from 0..65535. Could I use fixed
point numbers to hide the different precision: e.g.

type Small_Component is delta 1/255 range 0.0 .. 1.0
type Wide_Component is delta 1/65535 range 0.0 .. 1.0

type Small_RGB is record
  r,g,b:Small_Component
end record

type Wide_RGB is record
  r,g,b:Wide_Component
end record

Then later I could use something like this to convert between the
different precisions:

w : Wide_RGB
s : Small_RGB


w.r = Wide_Component(s.r);

I tried to implement this but suprisingly Wide_Component(
Small_Component(1.0)) < 1.0 ? Does somebody know a workaround?

Thanks, Pat



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-03-04 13:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-01 11:49 Color components and fixed point numbers Pat
2004-03-01 16:24 ` Robert I. Eachus
2004-03-02 10:58   ` Pat
2004-03-02 16:39     ` Robert I. Eachus
2004-03-02 22:23     ` tmoran
2004-03-04 13:31       ` Pat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox