Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# IImage.h

Go to the documentation of this file.

    00001 // Copyright (C) 2002-2009 Nikolaus Gebhardt
    00002 // This file is part of the "Irrlicht Engine".
    00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
    00004
    00005 #ifndef __I_IMAGE_H_INCLUDED__
    00006 #define __I_IMAGE_H_INCLUDED__
    00007
    00008 #include "IReferenceCounted.h"
    00009 #include "position2d.h"
    00010 #include "rect.h"
    00011 #include "SColor.h"
    00012
    00013 namespace irr
    00014 {
    00015 namespace video
    00016 {
    00017
    00019
    00020 enum ECOLOR_FORMAT
    00021 {
    00023
    00026         ECF_A1R5G5B5 = 0,
    00027
    00029         ECF_R5G6B5,
    00030
    00032         ECF_R8G8B8,
    00033
    00035         ECF_A8R8G8B8,
    00036
    00039
    00040         ECF_R16F,
    00041
    00043         ECF_G16R16F,
    00044
    00046         ECF_A16B16G16R16F,
    00047
    00049         ECF_R32F,
    00050
    00052         ECF_G32R32F,
    00053
    00055         ECF_A32B32G32R32F,
    00056
    00058         ECF_UNKNOWN
    00059 };
    00060
    00061
    00063
    00066 class IImage : public virtual IReferenceCounted
    00067 {
    00068 public:
    00069
    00071
    00076         virtual void* lock() = 0;
    00077
    00079
    00081         virtual void unlock() = 0;
    00082
    00084         virtual const core::dimension2d<u32>& getDimension() const = 0;
    00085
    00087         virtual u32 getBitsPerPixel() const = 0;
    00088
    00090         virtual u32 getBytesPerPixel() const = 0;
    00091
    00093         virtual u32 getImageDataSizeInBytes() const = 0;
    00094
    00096         virtual u32 getImageDataSizeInPixels() const = 0;
    00097
    00099         virtual SColor getPixel(u32 x, u32 y) const = 0;
    00100
    00102         virtual void setPixel(u32 x, u32 y, const SColor &color, bool blend = false ) = 0;
    00103
    00105         virtual ECOLOR_FORMAT getColorFormat() const = 0;
    00106
    00108         virtual u32 getRedMask() const = 0;
    00109
    00111         virtual u32 getGreenMask() const = 0;
    00112
    00114         virtual u32 getBlueMask() const = 0;
    00115
    00117         virtual u32 getAlphaMask() const = 0;
    00118
    00120         virtual u32 getPitch() const =0;
    00121
    00123         virtual void copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT format=ECF_A8R8G8B8, u32 pitch=0) =0;
    00124
    00126         virtual void copyToScaling(IImage* target) =0;
    00127
    00129         virtual void copyTo(IImage* target, const core::position2d<s32>& pos=core::position2d<s32>(0,0)) =0;
    00130
    00132         virtual void copyTo(IImage* target, const core::position2d<s32>& pos, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect=0) =0;
    00133
    00135         virtual void copyToWithAlpha(IImage* target, const core::position2d<s32>& pos,
    00136                         const core::rect<s32>& sourceRect, const SColor &color,
    00137                         const core::rect<s32>* clipRect = 0) =0;
    00138
    00140         virtual void copyToScalingBoxFilter(IImage* target, s32 bias = 0, bool blend = false) = 0;
    00141
    00143         virtual void fill(const SColor &color) =0;
    00144
    00146         static u32 getBitsPerPixelFromFormat(const ECOLOR_FORMAT format)
    00147         {
    00148                 switch(format)
    00149                 {
    00150                 case ECF_A1R5G5B5:
    00151                         return 16;
    00152                 case ECF_R5G6B5:
    00153                         return 16;
    00154                 case ECF_R8G8B8:
    00155                         return 24;
    00156                 case ECF_A8R8G8B8:
    00157                         return 32;
    00158                 case ECF_R16F:
    00159                         return 16;
    00160                 case ECF_G16R16F:
    00161                         return 32;
    00162                 case ECF_A16B16G16R16F:
    00163                         return 64;
    00164                 case ECF_R32F:
    00165                         return 32;
    00166                 case ECF_G32R32F:
    00167                         return 64;
    00168                 case ECF_A32B32G32R32F:
    00169                         return 128;
    00170                 default:
    00171                         return 0;
    00172                 }
    00173         }
    00174
    00176
    00179         static bool isRenderTargetOnlyFormat(const ECOLOR_FORMAT format)
    00180         {
    00181                 switch(format)
    00182                 {
    00183                         case ECF_A1R5G5B5:
    00184                         case ECF_R5G6B5:
    00185                         case ECF_R8G8B8:
    00186                         case ECF_A8R8G8B8:
    00187                                 return false;
    00188                         default:
    00189                                 return true;
    00190                 }
    00191         }
    00192
    00193 };
    00194
    00195 } // end namespace video
    00196 } // end namespace irr
    00197
    00198 #endif
    00199

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Feb 14 13:06:57 2010 by Doxygen (1.6.2)