#Color Cycleing
3 messages in this thread
I'm trying to figure out how to do color cycling. I have created a 16 color
hires screen with the colors that I want and have allocated a backdrop window
to draw into. Now what I want to do is cycle all the color table entries, ie.
make table entry number 1 number 2, etc then when I get to entry 15 make it
color number 1 and so on. I've allocated a colormap structure so that I can
have a temporary working area to shift the colors around in. How do I read the
screens colortable into this copy, make my changes and rewrite it and update
the screen display. It looked like I would have to make succesive calls to
GetRGB4 to get each color table entry, then after moving them around, use
LoadRGB4 to write them back to the color table, update the screens pointer to
the new colortable and then call ReThinkDisplay. Is this correct?
Thanks,
Gary
Gary,
why fiddling around with colormaps ? Just read the current values with
GetRGB4() and push them in a rotating manner into a colortable, then call
LoadRGB4(). Thats all.
You cannot directly move around colors in colormaps, because they are
hardware specific structures and you should not count on them to be
anything you can understand. You only may use SetRGB4CM() to set colors in
a colormap before it is linked to a viewport. Beginning with OS 2.0, first
of all, you must tell the colormap about the viewport it will be linked to
using VideoControl(). After all, you can link it into the ViewPort and
call MakeVPort() to display the new colors. So, if you let your display
being set up by intuition, best thing is leaving the colormaps untouched.
SetRGB4() and LoadRGB4() only work with the colormap already attached to
the viewport (in your case intuition has done this for you), and will
refresh the colors automagically.
– wkc – … via AP from Hamburg, Germany
Thanks for the tip, worked like a charm!
TYL,
Gary