Irrlicht 3D Engine
 
Loading...
Searching...
No Matches
IImage.h
Go to the documentation of this file.
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 __I_IMAGE_H_INCLUDED__
6#define __I_IMAGE_H_INCLUDED__
7
8#include "IReferenceCounted.h"
9#include "position2d.h"
10#include "rect.h"
11#include "SColor.h"
12
13namespace irr
14{
15namespace video
16{
17
19
22class IImage : public virtual IReferenceCounted
23{
24public:
25
27
32 virtual void* lock() = 0;
33
35
37 virtual void unlock() = 0;
38
40 virtual const core::dimension2d<u32>& getDimension() const = 0;
41
43 virtual u32 getBitsPerPixel() const = 0;
44
46 virtual u32 getBytesPerPixel() const = 0;
47
49 virtual u32 getImageDataSizeInBytes() const = 0;
50
52 virtual u32 getImageDataSizeInPixels() const = 0;
53
55 virtual SColor getPixel(u32 x, u32 y) const = 0;
56
58 virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) = 0;
59
61 virtual ECOLOR_FORMAT getColorFormat() const = 0;
62
64 virtual u32 getRedMask() const = 0;
65
67 virtual u32 getGreenMask() const = 0;
68
70 virtual u32 getBlueMask() const = 0;
71
73 virtual u32 getAlphaMask() const = 0;
74
76 virtual u32 getPitch() const =0;
77
79 virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) =0;
80
82 virtual void copyToScaling(IImage* target) =0;
83
85 virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)) =0;
86
88 virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0) =0;
89
91 virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
92 const core::rect<s32>& sourceRect, const SColor &color,
93 const core::rect<s32>* clipRect = 0) =0;
94
96 virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
97
99 virtual void fill(const SColor &color) =0;
100
103 {
104 switch(format)
105 {
106 case ECF_A1R5G5B5:
107 return 16;
108 case ECF_R5G6B5:
109 return 16;
110 case ECF_R8G8B8:
111 return 24;
112 case ECF_A8R8G8B8:
113 return 32;
114 case ECF_R16F:
115 return 16;
116 case ECF_G16R16F:
117 return 32;
119 return 64;
120 case ECF_R32F:
121 return 32;
122 case ECF_G32R32F:
123 return 64;
125 return 128;
126 default:
127 return 0;
128 }
129 }
130
132
135 static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
136 {
137 switch(format)
138 {
139 case ECF_A1R5G5B5:
140 case ECF_R5G6B5:
141 case ECF_R8G8B8:
142 case ECF_A8R8G8B8:
143 return false;
144 default:
145 return true;
146 }
147 }
148
149};
150
151} // end namespace video
152} // end namespace irr
153
154#endif
155
Base class of most objects of the Irrlicht Engine.
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.h:22
Interface for software image data.
Definition IImage.h:23
virtual void fill(const SColor &color)=0
fills the surface with given color
virtual SColor getPixel(u32 x, u32 y) const =0
Returns a pixel.
virtual u32 getBytesPerPixel() const =0
Returns bytes per pixel.
virtual u32 getGreenMask() const =0
Returns mask for green value of a pixel.
virtual const core::dimension2d< u32 > & getDimension() const =0
Returns width and height of image data.
virtual u32 getBlueMask() const =0
Returns mask for blue value of a pixel.
virtual u32 getAlphaMask() const =0
Returns mask for alpha value of a pixel.
virtual void copyToScalingBoxFilter(IImage *target, s32 bias=0, bool blend=false)=0
copies this surface into another, scaling it to fit, appyling a box filter
virtual void copyToScaling(void *target, u32 width, u32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0)=0
Copies the image into the target, scaling the image to fit.
static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
get the amount of Bits per Pixel of the given color format
Definition IImage.h:102
virtual void copyToWithAlpha(IImage *target, const core::position2d< s32 > &pos, const core::rect< s32 > &sourceRect, const SColor &color, const core::rect< s32 > *clipRect=0)=0
copies this surface into another, using the alpha mask and cliprect and a color to add with
virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend=false)=0
Sets a pixel.
virtual u32 getImageDataSizeInPixels() const =0
Returns image data size in pixels.
virtual void copyToScaling(IImage *target)=0
Copies the image into the target, scaling the image to fit.
virtual u32 getPitch() const =0
Returns pitch of image.
virtual u32 getImageDataSizeInBytes() const =0
Returns image data size in bytes.
virtual u32 getRedMask() const =0
Returns mask for red value of a pixel.
static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
test if the color format is only viable for RenderTarget textures
Definition IImage.h:135
virtual void copyTo(IImage *target, const core::position2d< s32 > &pos, const core::rect< s32 > &sourceRect, const core::rect< s32 > *clipRect=0)=0
copies this surface into another
virtual void * lock()=0
Lock function. Use this to get a pointer to the image data.
virtual ECOLOR_FORMAT getColorFormat() const =0
Returns the color format.
virtual void unlock()=0
Unlock function.
virtual u32 getBitsPerPixel() const =0
Returns bits per pixel.
virtual void copyTo(IImage *target, const core::position2d< s32 > &pos=core::position2d< s32 >(0, 0))=0
copies this surface into another
Class representing a 32 bit ARGB color.
Definition SColor.h:202
ECOLOR_FORMAT
An enum for the color format of textures used by the Irrlicht Engine.
Definition SColor.h:18
@ ECF_A1R5G5B5
16 bit color format used by the software driver.
Definition SColor.h:23
@ ECF_A32B32G32R32F
128 bit floating point format. 32 bits are used for the red, green, blue and alpha channels.
Definition SColor.h:52
@ ECF_R8G8B8
24 bit color, no alpha channel, but 8 bit for red, green and blue.
Definition SColor.h:29
@ ECF_R5G6B5
Standard 16 bit color format.
Definition SColor.h:26
@ ECF_A8R8G8B8
Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha.
Definition SColor.h:32
@ ECF_A16B16G16R16F
64 bit floating point format 16 bits are used for the red, green, blue and alpha channels.
Definition SColor.h:43
@ ECF_G32R32F
64 bit floating point format using 32 bits for the red channel and 32 bits for the green channel.
Definition SColor.h:49
@ ECF_R16F
16 bit floating point format using 16 bits for the red channel.
Definition SColor.h:37
@ ECF_R32F
32 bit floating point format using 32 bits for the red channel.
Definition SColor.h:46
@ ECF_G16R16F
32 bit floating point format using 16 bits for the red channel and 16 bits for the green channel.
Definition SColor.h:40
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
signed int s32
32 bit signed variable.
Definition irrTypes.h:66