Path: utzoo!attcan!uunet!nuchat!sugar!peter From: peter@sugar.UUCP (Peter da Silva) Newsgroups: comp.sys.amiga Subject: Re: Novice Intuition Graphics Questions Keywords: Colormap, Fades Message-ID: <2235@sugar.UUCP> Date: 2 Jul 88 04:09:02 GMT References: <216@dsacg2.UUCP> Organization: Sugar Land UNIX - Houston, TX Lines: 64 In article <216@dsacg2.UUCP>, nor1675@dsacg2.UUCP (Michael Figg) writes: > What is the preffered way to save workbench/colortable settings before > changing them in a program. Is there an easy way to save 1 or 2 pen values > (entries) and restore them before termination. It looks like GetRGB4 and > SetRGB4 have conflicting formats. Does the whole colormap need to be saved > and is always 64bytes? (It is 64 isn't it?) OK. You shouldn't be modifying the Workbench colormap. If you want your own set of colors, you open a new screen with the appropriate number of bitplanes for the number of colors you want. Then you can SetRGB4 the colors in the new screen. You don't have to set them back. When you close the screen it disappears. > Along the same lines, any ideas on how to do good fades? I would assume cycling > thru desired colorvalues with SetRGB4 would do it but does anything need to > refreshed or relinked after changing the value? No. The trickyest part about getting fades right is fading down the R, G, and B values at the same rate. The best way of doing it is to use what I call the variable duty cycle algorithm... after the article about it in Byte some years back. Let's say you have N colors you want to fade to black. Here's some pseudocode. This is written, and adapted to multiple colors, pretty much from memory. Excuse any errors... FadeToBlack(colors: integer[M][3], M: integer, faderate: integer): counter: integer[M][3]; initial: integer[M][3]; maxcolor: integer; maxcolor = max(colors); -- get maximum value of the colors. initial = colors; -- save initial value of all the colors. counter = maxcolor; -- set each counter to maxcolor; while not done: done = true; for each color