DIB and Palette demo code project thingy wotsit.
------------------------------------------------

Donated to the Public domain by me
John Biddiscombe
J.Biddiscombe@rl.ac.uk

-----------------------------------------
this is for 256 colour display modes only
-----------------------------------------

I always use 236 colour palettes to spare windows the grief of mucking up my
colours.
When show system colours is checked, 0-9 and 246-255 are visible too

basically assume you have 236 colours and plot 10 upwards.
->the sinusoid demo covers it nicely.

-
also
 in the Create method for the DIB_surface_object the Pal_indices are allowed
 an offset, I've used 0, but if you put 10 in, then your colours can be
 accessed from 0-235 instead of 10-245. (Handy - I've used this lately)

You can use all the normal API calls to draw on the DIB, just use the DC of
the DIB and moveto,lineto as normal.

I use the DIB really only for doing colour plots of 2D data, so I select
(usually HSV) a palette and just plot pixels.


NB - some of the palettes I've included are not 236 entries,
EG CHROMA.PAL...
The palette creation routine in Palunit, wraps the colours round if there are less
than 236, you should check the pal_colours variable if you want to do something
like the sinusoid without dodgy colours appearing.

Nearly all my programs use ONE palette at a time, so if you have an MDI type
program and need different palettes in different windows, then I guess you know
what you are doing and don't need my help modifying this code.

I must thank the Fractint/WinFract team for allowing me to steal their palettes
and distribute them. For an example of these palettes in action have a look
at Zonerings on
                http://www.hyperreal.com/tools/win3/graphics/eye_candy/

I must also add that most of the palettes are cyclic (wrap around) - because I
used them for palette cycling.


DELPHI SCREWS UP YOUR PALETTES - I'm sure the people at Borland meant well when
they did all the Delphi graphics stuff, but all my software worked just fine
under BPW, and I had to make a lot of modifications when porting to Delphi
regarding Palette stuff. (and DC's but that's another story).


I Hope this helps someone.

John B


