home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d2xx
/
d242
/
palettereq
/
palettereq.doc
< prev
next >
Wrap
Text File
|
1989-08-30
|
5KB
|
107 lines
/****************************************************************************
* *
* Palette Requester *
* *
* (c) Copyright 1989 Jonathan Potter *
* *
* This program is freely redistributable, although all rights to it remain *
* with the author. It may be used freely in any program as long as this *
* notice remains intact, however, if you do this, please mention the *
* author in the program. If you wish to use this in a commercial program *
* of any kind, you must register with a $15 donation. *
* Please send donations, bug reports, comments and suggestions to : *
* *
* Jonathan Potter *
* 3 William Street *
* Clarence Park 5034 *
* South Australia *
* Australia *
* *
* Ph : (08) 2932788 home *
* *
****************************************************************************/
Palette Requester provides a very easy way to set the palette of any screen.
HOW TO USE THE PALETTE REQUESTER
The palette requester has several gadgets to enable you to set the colours of
the screen. The coloured squares at the top of the window let you select
which colour you wish to work with. Underneath these is a window-wide bar,
which is filled with the current colour, and displays (in hex) the value of
the colour.
Under this are six slider gadgets. The first three, R, G and B enable you to
set the red, green and blue content of the current colour. The next three,
H, S and L enable you to set the hue, saturation and luminance of the
current colour.
Under these are six other gadgets.
- COPY allows you to copy the current colour to the next selected colour.
- SPREAD allows you to evenly spread the colours between the current
colour and the next selected colour.
- RESET allows you to reset to the palette in use when the Palette
Requester was first invoked. Also, pressing the ESCape key has this
effect, so if you accidentally set all the colours to black (or
something), just press ESCape.
Next to RESET there *MAY* be another gadget.
- OKAY accepts the current colour settings and exits the palette requester.
- CANCEL rejects the colour settings and exits the palette requester.
Clicking the close gadget also has this effect.
HOW TO CALL THE PALETTE REQUESTER
To use the palette requester, you should link with the file PaletteReq.o, and
include the file PaletteReq.h, to make use of return codes.
PaletteReq.o compiles like this under Aztec:
cc +L -S PaletteReq
and under Lattice like this:
lc PaletteReq (boy this is hard)
You must have intuition.library and graphics.library open before you call
(in IntuitionBase and GfxBase, of course).
To call the palette requester, you call the routine palette_request().
palette_request() takes several parameters; these are :
struct Window *dest_win;
int x, y;
char *hail, *user;
int depth;
dest_win is any window on the screen you wish the palette requester to appear
on, or NULL if you want it to open on the Workbench screen.
x, y are the x and y coordinates for the palette requester to open at, or
-1,-1 if you want the default 40,23.
hail is the hailing text, or NULL if you want the default "Palette".
user is the text for the user defined gadget (see below), or NULL if you
don't want one.
depth is the number of bitplanes you wish the palette requester to
accomodate (from 1 to 5). The palette requester will automatically adjust to
the selected depth (which will NOT be checked against the maximum depth of
the containing screen), so the correct number of colour gadgets will appear
(properly formatted, too).
The palette requester supports one user defined gadget, which can have a
name of up to fourteen characters. If a name is submitted to palette_request()
for this, it is created next to the RESET gadget, otherwise the RESET gadget
takes up the width of the window. If this gadget is selected, the requester
will exit as if OKAY had been chosen.
palette_request() returns FALSE if CANCEL was chosen, or the close gadget
was clicked, TRUE if OKAY was chosen, and 5 if the user defined gadget was
chosen. To interpret other return codes (errors), you should include the file
PaletteReq.h.
A calling example,
palette_request(NULL,-1,-1,"Neato!","Fantastic",2);
IS THAT ALL THERE IS TO IT?
Yup.