This reference page is linked to from the following overview
topics: Color
Palettes.
Detailed Description
- See also:
- Advanced Topics on Palettes, Class Color, Class GammaMgr, COLORREF.
- Description:
- A useful utility class for managing user interface colors. This
class has several purposes:
Maintain the default 3ds Max palette for doing 256 color
graphics.
Provides a mechanism for allocating "animated color slots" in the
default palette for use in the user interface.
Provide various functions for doing dithered graphics using the
default 3ds Max palette.
All methods of this class are implemented by the system.
The following global function is used to get a pointer that may be
used to call the methods of this class:
#include <gport.h>
List of all members.
Public Member Functions
|
virtual |
~GPort
() |
virtual
int |
AnimPalIndex
(int i)=0 |
virtual
int |
GetAnimPalSlot
()=0 |
virtual
void |
ReleaseAnimPalSlot
(int i)=0 |
virtual
void |
SetAnimPalEntry
(int i, COLORREF cr)=0 |
virtual
HPALETTE |
PlugPalette
(HDC hdc)=0 |
virtual
HBRUSH |
MakeAnimBrush
(int slotNum, COLORREF col)=0 |
virtual
int |
UpdateColors
(HDC hdc)=0 |
virtual
void |
AnimPalette
(HDC hdc)=0 |
virtual
void |
RestorePalette
(HDC hDC, HPALETTE hOldPal)=0 |
virtual
void |
MapPixels
(UBYTE *inp, UBYTE *outp, int x, int y, int width)=0 |
virtual
void |
DisplayMap
(HDC hdc, Rect &drect,
int xsrc, int ysrc, UBYTE *map, int bytesPerRow)=0 |
virtual
void |
DisplayMap
(HDC hdc, Rect &dest,
Rect &src, UBYTE *map,
int bytesPerRow)=0 |
virtual
void |
DitherColorSwatch
(HDC hdc, Rect &r,
Color c)=0 |
virtual
void |
PaintAnimPalSwatch
(HDC hdc, DWORD col, int slot, int left, int top, int right, int
bottom)=0 |
virtual
HPALETTE |
GetPalette
()=0 |
Constructor & Destructor Documentation
virtual ~GPort |
( |
|
) |
[inline, virtual] |
Member Function Documentation
virtual int AnimPalIndex |
( |
int |
i |
) |
[pure virtual] |
- Parameters:
- int i
Specifies the slot.
virtual int GetAnimPalSlot |
( |
|
) |
[pure virtual] |
- Returns:
- A slot number if available; otherwise -1.
virtual void ReleaseAnimPalSlot |
( |
int |
i |
) |
[pure virtual] |
- Parameters:
- int i
The palette slot to release.
virtual void SetAnimPalEntry |
( |
int |
i, |
|
|
COLORREF |
cr |
|
) |
|
[pure virtual] |
- Parameters:
- int i
The slot index.
COLORREF cr
The color to set.
virtual HPALETTE PlugPalette |
( |
HDC |
hdc |
) |
[pure virtual] |
- Parameters:
- HDC hdc
The device context.
- Returns:
- The handle of the old palette.
virtual HBRUSH MakeAnimBrush |
( |
int |
slotNum, |
|
|
COLORREF |
col |
|
) |
|
[pure virtual] |
- Parameters:
- int slotNum
The animated palette slot.
COLORREF col
The color to use.
- Returns:
- The handle of the brush created.
virtual int UpdateColors |
( |
HDC |
hdc |
) |
[pure virtual] |
- Parameters:
- HDC hdc
The handle of the device context.
- Returns:
- Nonzero if it changed screen pixel values; otherwise zero.
virtual void AnimPalette |
( |
HDC |
hdc |
) |
[pure virtual] |
- Parameters:
- HDC hdc
The handle of the device context.
virtual void RestorePalette |
( |
HDC |
hDC, |
|
|
HPALETTE |
hOldPal |
|
) |
|
[pure virtual] |
- Parameters:
- HDC hDC
The handle of the device context.
HPALETTE hOldPal
The palette to restore.
virtual void MapPixels |
( |
UBYTE * |
inp, |
|
|
UBYTE * |
outp, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
width |
|
) |
|
[pure virtual] |
- Parameters:
- UBYTE* inp
Points to an array of width BGR triples. This is a sequence of
bytes structured as B,G,R,B,G R, etc. The first pixel is B,G,R then
the next pixel is B,G,R, etc.
UBYTE *outp
The result - the color indices into the GPort palette. This array is width
bytes in length.
int x
The x alignment position.
int y
The y alignment position.
int width
The number of items in the arrays above.
virtual void DisplayMap |
( |
HDC |
hdc, |
|
|
Rect
& |
drect, |
|
|
int |
xsrc, |
|
|
int |
ysrc, |
|
|
UBYTE * |
map, |
|
|
int |
bytesPerRow |
|
) |
|
[pure virtual] |
- Parameters:
- HDC hdc
The handle of the device context.
Rect& drect
The destination rectangle in the hdc.
int xsrc
The X position within this source raster of the upper left corner
of the rectangle to be copied.
int ysrc
The Y position within this source raster of the upper left corner
of the rectangle to be copied.
UBYTE *map
Points to an array of BGR triples.
int bytesPerRow
The number of bytes per row on each scanline of map.
virtual void DisplayMap |
( |
HDC |
hdc, |
|
|
Rect
& |
dest, |
|
|
Rect
& |
src, |
|
|
UBYTE * |
map, |
|
|
int |
bytesPerRow |
|
) |
|
[pure virtual] |
- Parameters:
- HDC hdc
The handle of the device context.
Rect& dest
The destination rectangle in the hdc.
Rect& src
The source rectangle in map.
UBYTE *map
Points to an array of RGB triples.
int bytesPerRow
The number of bytes per row on each scanline of map.
virtual void DitherColorSwatch |
( |
HDC |
hdc, |
|
|
Rect
& |
r, |
|
|
Color |
c |
|
) |
|
[pure virtual] |
- Parameters:
- HDC hdc
The handle of the device context.
Rect& r
The rectangle to fill.
Color c
The color to approximate (8 bit) or fill with (24 bit).
virtual void PaintAnimPalSwatch |
( |
HDC |
hdc, |
|
|
DWORD |
col, |
|
|
int |
slot, |
|
|
int |
left, |
|
|
int |
top, |
|
|
int |
right, |
|
|
int |
bottom |
|
) |
|
[pure virtual] |
- Parameters:
- HDC hdc
The handle of the device context.
DWORD col
The color to paint. The format is the same as COLORREF.
int slot
Specifies the slot to use. If -1 then DitherColorSwatch()
is used.
int left
The left coordinate of the rectangular area to paint.
int top
The top coordinate of the rectangular area to paint.
int right
The right coordinate of the rectangular area to paint.
int bottom
The bottom coordinate of the rectangular area to paint.
virtual HPALETTE GetPalette |
( |
|
) |
[pure virtual] |