aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CColorConverter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CColorConverter.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CColorConverter.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CColorConverter.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CColorConverter.h
new file mode 100644
index 0000000..b3da9ad
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CColorConverter.h
@@ -0,0 +1,92 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_COLOR_CONVERTER_H_INCLUDED__
6#define __C_COLOR_CONVERTER_H_INCLUDED__
7
8#include "irrTypes.h"
9#include "IImage.h"
10
11namespace irr
12{
13namespace video
14{
15
16class CColorConverter
17{
18public:
19
20 //! converts a monochrome bitmap to A1R5G5B5
21 static void convert1BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, s32 linepad=0, bool flip=false);
22
23 //! converts a 4 bit palettized image to A1R5G5B5
24 static void convert4BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad=0, bool flip=false);
25
26 //! converts a 8 bit palettized image to A1R5G5B5
27 static void convert8BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad=0, bool flip=false);
28
29 //! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
30 static void convert8BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad = 0, bool flip=false);
31
32 //! converts a 8 bit palettized or non palettized image (A8) into A8R8G8B8
33 static void convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad = 0, bool flip=false);
34
35 //! converts R8G8B8 16 bit data to A1R5G5B5 data
36 static void convert16BitTo16Bit(const s16* in, s16* out, s32 width, s32 height, s32 linepad=0, bool flip=false);
37
38 //! copies R8G8B8 24 bit data to 24 data, and flips and
39 //! mirrors the image during the process.
40 static void convert24BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, s32 linepad=0, bool flip=false, bool bgr=false);
41
42 //! Resizes the surface to a new size and converts it at the same time
43 //! to an A8R8G8B8 format, returning the pointer to the new buffer.
44 static void convert16bitToA8R8G8B8andResize(const s16* in, s32* out, s32 newWidth, s32 newHeight, s32 currentWidth, s32 currentHeight);
45
46 //! copies X8R8G8B8 32 bit data, and flips and
47 //! mirrors the image during the process.
48 static void convert32BitTo32Bit(const s32* in, s32* out, s32 width, s32 height, s32 linepad, bool flip=false);
49
50
51 //! functions for converting one image format to another efficiently
52 //! and hopefully correctly.
53 //!
54 //! \param sP pointer to source pixel data
55 //! \param sN number of source pixels to copy
56 //! \param dP pointer to destination data buffer. must be big enough
57 //! to hold sN pixels in the output format.
58 static void convert_A1R5G5B5toR8G8B8(const void* sP, s32 sN, void* dP);
59 static void convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP);
60 static void convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP);
61 static void convert_A1R5G5B5toA1R5G5B5(const void* sP, s32 sN, void* dP);
62 static void convert_A1R5G5B5toR5G6B5(const void* sP, s32 sN, void* dP);
63
64 static void convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP);
65 static void convert_A8R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP);
66 static void convert_A8R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP);
67 static void convert_A8R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP);
68 static void convert_A8R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP);
69
70 static void convert_A8R8G8B8toR3G3B2(const void* sP, s32 sN, void* dP);
71 static void convert_R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP);
72 static void convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP);
73 static void convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP);
74 static void convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP);
75 static void convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP);
76 static void convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP);
77
78 static void convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP);
79 static void convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP);
80 static void convert_R5G6B5toB8G8R8(const void* sP, s32 sN, void* dP);
81 static void convert_R5G6B5toA8R8G8B8(const void* sP, s32 sN, void* dP);
82 static void convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP);
83 static void convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN,
84 void* dP, ECOLOR_FORMAT dF);
85};
86
87
88} // end namespace video
89} // end namespace irr
90
91#endif
92