1 #ifndef _COLOR_CONVERSION_H_
2 #define _COLOR_CONVERSION_H_
5 #include <GraphicsDefs.h>
12 status_t
ConvertBits(const void *srcBits
, void *dstBits
, int32 srcBitsLength
,
13 int32 dstBitsLength
, int32 srcBytesPerRow
, int32 dstBytesPerRow
,
14 color_space srcColorSpace
, color_space dstColorSpace
, int32 width
,
16 status_t
ConvertBits(const void *srcBits
, void *dstBits
, int32 srcBitsLength
,
17 int32 dstBitsLength
, int32 srcBytesPerRow
, int32 dstBytesPerRow
,
18 color_space srcColorSpace
, color_space dstColorSpace
, BPoint srcOffset
,
19 BPoint dstOffset
, int32 width
, int32 height
);
22 /*! \brief Helper class for conversion between RGB and palette colors.
24 class PaletteConverter
{
27 PaletteConverter(const rgb_color
*palette
);
28 PaletteConverter(const color_map
*colorMap
);
31 status_t
SetTo(const rgb_color
*palette
);
32 status_t
SetTo(const color_map
*colorMap
);
33 status_t
InitCheck() const;
35 inline uint8
IndexForRGB15(uint16 rgb
) const;
36 inline uint8
IndexForRGB15(uint8 red
, uint8 green
, uint8 blue
) const;
37 inline uint8
IndexForRGB16(uint16 rgb
) const;
38 inline uint8
IndexForRGB16(uint8 red
, uint8 green
, uint8 blue
) const;
39 inline uint8
IndexForRGB24(uint32 rgb
) const;
40 inline uint8
IndexForRGB24(uint8 red
, uint8 green
, uint8 blue
) const;
41 inline uint8
IndexForRGBA32(uint32 rgba
) const;
42 inline uint8
IndexForGray(uint8 gray
) const;
44 inline const rgb_color
&RGBColorForIndex(uint8 index
) const;
45 inline uint16
RGB15ColorForIndex(uint8 index
) const;
46 inline uint16
RGB16ColorForIndex(uint8 index
) const;
47 inline uint32
RGBA32ColorForIndex(uint8 index
) const;
48 inline void RGBA32ColorForIndex(uint8 index
, uint8
&red
, uint8
&green
,
49 uint8
&blue
, uint8
&alpha
) const;
50 inline uint8
GrayColorForIndex(uint8 index
) const;
52 static status_t
InitializeDefault(bool useServer
= false);
55 static void _InitializeDefaultAppServer();
56 static void _InitializeDefaultNoAppServer();
59 const color_map
*fColorMap
;
60 color_map
*fOwnColorMap
;
64 } // namespace BPrivate