1 ////////////////////////////////////////////////////////////////////////////////
7 // Author: Daniel Switkin
9 // Copyright 2003 (c) by Daniel Switkin. This file is made publically available
10 // under the BSD license, with the stipulations that this complete header must
11 // remain at the top of the file indefinitely, and credit must be given to the
12 // original author in any about box using this software.
14 ////////////////////////////////////////////////////////////////////////////////
16 // Additional authors: John Scipione, <jscipione@gmail.com>
18 #ifndef SAVE_PALETTE_H
19 #define SAVE_PALETTE_H
23 #include <GraphicsDefs.h>
35 COLOR_KEY_TRANSPARENCY
43 SavePalette(int mode
);
44 SavePalette(BBitmap
* bitmap
,
45 int32 maxSizeInBits
= 8);
46 virtual ~SavePalette();
48 inline bool IsValid() const
49 { return !fFatalError
; }
51 uint8
IndexForColor(uint8 red
, uint8 green
,
52 uint8 blue
, uint8 alpha
= 255);
53 inline uint8
IndexForColor(const rgb_color
& color
);
55 inline bool UseTransparent() const
56 { return fTransparentMode
> NO_TRANSPARENCY
; }
58 void PrepareForAutoTransparency();
59 inline int TransparentIndex() const
60 { return fTransparentIndex
; }
61 void SetTransparentColor(uint8 red
,
62 uint8 green
, uint8 blue
);
64 inline int SizeInBits() const { return fSizeInBits
; }
66 inline int BackgroundIndex() const
67 { return fBackgroundIndex
; }
69 void GetColors(uint8
* buffer
, int size
) const;
77 uint32 fTransparentMode
;
78 int fTransparentIndex
;
85 SavePalette::IndexForColor(const rgb_color
& color
)
87 return IndexForColor(color
.red
, color
.green
, color
.blue
, color
.alpha
);
91 #endif // SAVE_PALETTE_H