Date: Wed, 22 Oct 1997 14:11:06 -0400 (EDT) Message-Id: <199710221811.OAA25850@delorie.com> To: DJGPP mailing list From: Alexander Bokovoy Subject: Re: Colors in a consistent way. In-Reply-To: <3.0.16.19971021133718.36cf2982@hem1.passagen.se> References: <3 DOT 0 DOT 16 DOT 19971021133718 DOT 36cf2982 AT hem1 DOT passagen DOT se> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk On Tue, 21 Oct 1997 13:38:11 -0400 Peter Palotas wrote: > In a GUI, or another program that will work in multiple graphic modes,how > should one handle colors in a consistent way? In 15, 16, 24, 32 bit modes > this is no real problem, all you need to do is use a function like > allegro's makecol() which will return a proper color value. > > But how should one handle the palette in 256 color modes? If one for > example wants the user to be able to load several pictures, and they all > should look good. One would then have to dither the pictures, but to what > palette? Should one stick to a standard palette all the time, or should one > change it dynamically? > > How does ex. browsers in windows 256 color mode do this? I.e. does Netscape > have a consistent palette or does it change? (I have a list of 220 or so > colors that Netscape and internet explorer doesn't dither, so I suppose > those colors are always there, but what about the rest?) > For example how to implement dithering algorithm you can see in SWORD's sources (src/graphics/colors.cc and tools/colors/colors.cc).The first is a "dither client" and the second is a program that computes a dithering table. Another way (I'm not sure but it may be work) is implemented in MGL sources (see src/quick3d/srgbmod.cpp). The SWORD's model has advantage in speed but it costs some memory ( usually about 500k in 2.0 version and 192k in SWORD 2.50 beta prerelease). MGL's model is compact but do floating point calculations during dithering. You may agree with it if prefer a program slowdown. Alexander Bokovoy, ---== The Soft Age coming soon ==---