diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CImage.h | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CImage.h b/libraries/irrlicht-1.8/source/Irrlicht/CImage.h index 82b34c7..e97458b 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CImage.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CImage.h | |||
@@ -1,127 +1,127 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_IMAGE_H_INCLUDED__ | 5 | #ifndef __C_IMAGE_H_INCLUDED__ |
6 | #define __C_IMAGE_H_INCLUDED__ | 6 | #define __C_IMAGE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IImage.h" | 8 | #include "IImage.h" |
9 | #include "rect.h" | 9 | #include "rect.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | namespace video | 13 | namespace video |
14 | { | 14 | { |
15 | 15 | ||
16 | //! IImage implementation with a lot of special image operations for | 16 | //! IImage implementation with a lot of special image operations for |
17 | //! 16 bit A1R5G5B5/32 Bit A8R8G8B8 images, which are used by the SoftwareDevice. | 17 | //! 16 bit A1R5G5B5/32 Bit A8R8G8B8 images, which are used by the SoftwareDevice. |
18 | class CImage : public IImage | 18 | class CImage : public IImage |
19 | { | 19 | { |
20 | public: | 20 | public: |
21 | 21 | ||
22 | //! constructor from raw image data | 22 | //! constructor from raw image data |
23 | /** \param useForeignMemory: If true, the image will use the data pointer | 23 | /** \param useForeignMemory: If true, the image will use the data pointer |
24 | directly and own it from now on, which means it will also try to delete [] the | 24 | directly and own it from now on, which means it will also try to delete [] the |
25 | data when the image will be destructed. If false, the memory will by copied. */ | 25 | data when the image will be destructed. If false, the memory will by copied. */ |
26 | CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, | 26 | CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size, |
27 | void* data, bool ownForeignMemory=true, bool deleteMemory = true); | 27 | void* data, bool ownForeignMemory=true, bool deleteMemory = true); |
28 | 28 | ||
29 | //! constructor for empty image | 29 | //! constructor for empty image |
30 | CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size); | 30 | CImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size); |
31 | 31 | ||
32 | //! destructor | 32 | //! destructor |
33 | virtual ~CImage(); | 33 | virtual ~CImage(); |
34 | 34 | ||
35 | //! Lock function. | 35 | //! Lock function. |
36 | virtual void* lock() | 36 | virtual void* lock() |
37 | { | 37 | { |
38 | return Data; | 38 | return Data; |
39 | } | 39 | } |
40 | 40 | ||
41 | //! Unlock function. | 41 | //! Unlock function. |
42 | virtual void unlock() {} | 42 | virtual void unlock() {} |
43 | 43 | ||
44 | //! Returns width and height of image data. | 44 | //! Returns width and height of image data. |
45 | virtual const core::dimension2d<u32>& getDimension() const; | 45 | virtual const core::dimension2d<u32>& getDimension() const; |
46 | 46 | ||
47 | //! Returns bits per pixel. | 47 | //! Returns bits per pixel. |
48 | virtual u32 getBitsPerPixel() const; | 48 | virtual u32 getBitsPerPixel() const; |
49 | 49 | ||
50 | //! Returns bytes per pixel | 50 | //! Returns bytes per pixel |
51 | virtual u32 getBytesPerPixel() const; | 51 | virtual u32 getBytesPerPixel() const; |
52 | 52 | ||
53 | //! Returns image data size in bytes | 53 | //! Returns image data size in bytes |
54 | virtual u32 getImageDataSizeInBytes() const; | 54 | virtual u32 getImageDataSizeInBytes() const; |
55 | 55 | ||
56 | //! Returns image data size in pixels | 56 | //! Returns image data size in pixels |
57 | virtual u32 getImageDataSizeInPixels() const; | 57 | virtual u32 getImageDataSizeInPixels() const; |
58 | 58 | ||
59 | //! returns mask for red value of a pixel | 59 | //! returns mask for red value of a pixel |
60 | virtual u32 getRedMask() const; | 60 | virtual u32 getRedMask() const; |
61 | 61 | ||
62 | //! returns mask for green value of a pixel | 62 | //! returns mask for green value of a pixel |
63 | virtual u32 getGreenMask() const; | 63 | virtual u32 getGreenMask() const; |
64 | 64 | ||
65 | //! returns mask for blue value of a pixel | 65 | //! returns mask for blue value of a pixel |
66 | virtual u32 getBlueMask() const; | 66 | virtual u32 getBlueMask() const; |
67 | 67 | ||
68 | //! returns mask for alpha value of a pixel | 68 | //! returns mask for alpha value of a pixel |
69 | virtual u32 getAlphaMask() const; | 69 | virtual u32 getAlphaMask() const; |
70 | 70 | ||
71 | //! returns a pixel | 71 | //! returns a pixel |
72 | virtual SColor getPixel(u32 x, u32 y) const; | 72 | virtual SColor getPixel(u32 x, u32 y) const; |
73 | 73 | ||
74 | //! sets a pixel | 74 | //! sets a pixel |
75 | virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ); | 75 | virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ); |
76 | 76 | ||
77 | //! returns the color format | 77 | //! returns the color format |
78 | virtual ECOLOR_FORMAT getColorFormat() const; | 78 | virtual ECOLOR_FORMAT getColorFormat() const; |
79 | 79 | ||
80 | //! returns pitch of image | 80 | //! returns pitch of image |
81 | virtual u32 getPitch() const { return Pitch; } | 81 | virtual u32 getPitch() const { return Pitch; } |
82 | 82 | ||
83 | //! copies this surface into another, scaling it to fit. | 83 | //! copies this surface into another, scaling it to fit. |
84 | virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format, u32 pitch=0); | 84 | virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format, u32 pitch=0); |
85 | 85 | ||
86 | //! copies this surface into another, scaling it to fit. | 86 | //! copies this surface into another, scaling it to fit. |
87 | virtual void copyToScaling(IImage* target); | 87 | virtual void copyToScaling(IImage* target); |
88 | 88 | ||
89 | //! copies this surface into another | 89 | //! copies this surface into another |
90 | virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)); | 90 | virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)); |
91 | 91 | ||
92 | //! copies this surface into another | 92 | //! copies this surface into another |
93 | virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0); | 93 | virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0); |
94 | 94 | ||
95 | //! copies this surface into another, using the alpha mask, an cliprect and a color to add with | 95 | //! copies this surface into another, using the alpha mask, an cliprect and a color to add with |
96 | virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, | 96 | virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos, |
97 | const core::rect<s32>& sourceRect, const SColor &color, | 97 | const core::rect<s32>& sourceRect, const SColor &color, |
98 | const core::rect<s32>* clipRect = 0); | 98 | const core::rect<s32>* clipRect = 0); |
99 | 99 | ||
100 | //! copies this surface into another, scaling it to fit, appyling a box filter | 100 | //! copies this surface into another, scaling it to fit, appyling a box filter |
101 | virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false); | 101 | virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false); |
102 | 102 | ||
103 | //! fills the surface with given color | 103 | //! fills the surface with given color |
104 | virtual void fill(const SColor &color); | 104 | virtual void fill(const SColor &color); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | 107 | ||
108 | //! assumes format and size has been set and creates the rest | 108 | //! assumes format and size has been set and creates the rest |
109 | void initData(); | 109 | void initData(); |
110 | 110 | ||
111 | inline SColor getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const; | 111 | inline SColor getPixelBox ( s32 x, s32 y, s32 fx, s32 fy, s32 bias ) const; |
112 | 112 | ||
113 | u8* Data; | 113 | u8* Data; |
114 | core::dimension2d<u32> Size; | 114 | core::dimension2d<u32> Size; |
115 | u32 BytesPerPixel; | 115 | u32 BytesPerPixel; |
116 | u32 Pitch; | 116 | u32 Pitch; |
117 | ECOLOR_FORMAT Format; | 117 | ECOLOR_FORMAT Format; |
118 | 118 | ||
119 | bool DeleteMemory; | 119 | bool DeleteMemory; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | } // end namespace video | 122 | } // end namespace video |
123 | } // end namespace irr | 123 | } // end namespace irr |
124 | 124 | ||
125 | 125 | ||
126 | #endif | 126 | #endif |
127 | 127 | ||