- Main Page
- Data Structures
- Files

# /home/dwoods/DevIL/include/IL/devil_cpp_wrapper.hpp

    00001 #ifndef DEVIL_CPP_WRAPPER_HPP
    00002 #define DEVIL_CPP_WRAPPER_HPP
    00003
    00004 #include <IL/ilut.h>  // Probably only have to #include this one
    00005
    00006 class ilImage
    00007 {
    00008 public:
    00009                                 ilImage();
    00010                                 ilImage(ILconst_string);
    00011                                 ilImage(const ilImage &);
    00012         virtual         ~ilImage();
    00013
    00014         ILboolean       Load(ILconst_string);
    00015         ILboolean       Load(ILconst_string, ILenum);
    00016         ILboolean       Save(ILconst_string);
    00017         ILboolean       Save(ILconst_string, ILenum);
    00018
    00019         // ImageLib functions
    00020         ILboolean       ActiveImage(ILuint);
    00021         ILboolean       ActiveLayer(ILuint);
    00022         ILboolean       ActiveMipmap(ILuint);
    00023         ILboolean       Clear(void);
    00024         void            ClearColour(ILclampf, ILclampf, ILclampf, ILclampf);
    00025         ILboolean       Convert(ILenum);
    00026         ILboolean       Copy(ILuint);
    00027         ILboolean       Default(void);
    00028         ILboolean       Flip(void);
    00029         ILboolean       SwapColours(void);
    00030         ILboolean       Resize(ILuint, ILuint, ILuint);
    00031         ILboolean       TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, void*);
    00032
    00033         // Image handling
    00034         void            Bind(void) const;
    00035         void            Bind(ILuint);
    00036         void            Close(void) { this->Delete(); }
    00037         void            Delete(void);
    00038         void            iGenBind();
    00039         ILenum          PaletteAlphaIndex();
    00040
    00041         // Image characteristics
    00042         ILuint          Width(void);
    00043         ILuint          Height(void);
    00044         ILuint          Depth(void);
    00045         ILubyte         Bpp(void);
    00046         ILubyte         Bitpp(void);
    00047         ILenum          PaletteType(void);
    00048         ILenum          Format(void);
    00049         ILenum          Type(void);
    00050         ILuint          NumImages(void);
    00051         ILuint          NumMipmaps(void);
    00052         ILuint          GetId(void) const;
    00053     ILenum      GetOrigin(void);
    00054         ILubyte         *GetData(void);
    00055         ILubyte         *GetPalette(void);
    00056
    00057         // Rendering
    00058         ILuint          BindImage(void);
    00059         ILuint          BindImage(ILenum);
    00060
    00061         // Operators
    00062         ilImage&        operator = (ILuint);
    00063         ilImage&        operator = (const ilImage &);
    00064
    00065 protected:
    00066         ILuint          Id;
    00067
    00068 private:
    00069         static int              ilStartUp();
    00070         static ILboolean        ilStartedUp;
    00071 };
    00072
    00073 // ensure that init is called exactly once
    00074 int ilImage::ilStartUp()
    00075 {
    00076         ilInit();
    00077         iluInit();
    00078         //ilutInit();
    00079         return true;
    00080 }
    00081 ILboolean ilImage::ilStartedUp = ilStartUp();
    00082
    00083 class ilFilters
    00084 {
    00085 public:
    00086         static ILboolean        Alienify(ilImage &);
    00087         static ILboolean        BlurAvg(ilImage &, ILuint Iter);
    00088         static ILboolean        BlurGaussian(ilImage &, ILuint Iter);
    00089         static ILboolean        Contrast(ilImage &, ILfloat Contrast);
    00090         static ILboolean        EdgeDetectE(ilImage &);
    00091         static ILboolean        EdgeDetectP(ilImage &);
    00092         static ILboolean        EdgeDetectS(ilImage &);
    00093         static ILboolean        Emboss(ilImage &);
    00094         static ILboolean        Gamma(ilImage &, ILfloat Gamma);
    00095         static ILboolean        Negative(ilImage &);
    00096         static ILboolean        Noisify(ilImage &, ILubyte Factor);
    00097         static ILboolean        Pixelize(ilImage &, ILuint PixSize);
    00098         static ILboolean        Saturate(ilImage &, ILfloat Saturation);
    00099         static ILboolean        Saturate(ilImage &, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
    00100         static ILboolean        ScaleColours(ilImage &, ILfloat r, ILfloat g, ILfloat b);
    00101         static ILboolean        Sharpen(ilImage &, ILfloat Factor, ILuint Iter);
    00102 };
    00103
    00104 #ifdef ILUT_USE_OPENGL
    00105 class ilOgl
    00106 {
    00107 public:
    00108         static void                     Init(void);
    00109         static GLuint           BindTex(ilImage &);
    00110         static ILboolean        Upload(ilImage &, ILuint);
    00111         static GLuint           Mipmap(ilImage &);
    00112         static ILboolean        Screen(void);
    00113         static ILboolean        Screenie(void);
    00114 };
    00115 #endif//ILUT_USE_OPENGL
    00116
    00117
    00118 #ifdef ILUT_USE_ALLEGRO
    00119 class ilAlleg
    00120 {
    00121 public:
    00122         static void     Init(void);
    00123         static BITMAP   *Convert(ilImage &);
    00124 };
    00125 #endif//ILUT_USE_ALLEGRO
    00126
    00127
    00128 #ifdef ILUT_USE_WIN32
    00129 class ilWin32
    00130 {
    00131 public:
    00132         static void             Init(void);
    00133         static HBITMAP          Convert(ilImage &);
    00134         static ILboolean        GetClipboard(ilImage &);
    00135         static void             GetInfo(ilImage &, BITMAPINFO *Info);
    00136         static ILubyte          *GetPadData(ilImage &);
    00137         static HPALETTE         GetPal(ilImage &);
    00138         static ILboolean        GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType);
    00139         static ILboolean        GetResource(ilImage &, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type);
    00140         static ILboolean        SetClipboard(ilImage &);
    00141 };
    00142 #endif//ILUT_USE_WIN32
    00143
    00144
    00145 class ilValidate
    00146 {
    00147 public:
    00148         static ILboolean        Valid(ILenum, ILconst_string);
    00149         static ILboolean        Valid(ILenum, FILE *);
    00150         static ILboolean        Valid(ILenum, void *, ILuint);
    00151
    00152 protected:
    00153
    00154 private:
    00155
    00156 };
    00157
    00158 class ilState
    00159 {
    00160 public:
    00161         static ILboolean                Disable(ILenum);
    00162         static ILboolean                Enable(ILenum);
    00163         static void                             Get(ILenum, ILboolean &);
    00164         static void                             Get(ILenum, ILint &);
    00165         static ILboolean                GetBool(ILenum);
    00166         static ILint                    GetInt(ILenum);
    00167         static const char               *GetString(ILenum);
    00168         static ILboolean                IsDisabled(ILenum);
    00169         static ILboolean                IsEnabled(ILenum);
    00170         static ILboolean                Origin(ILenum);
    00171         static void                             Pop(void);
    00172         static void                             Push(ILuint);
    00173
    00174 protected:
    00175
    00176 private:
    00177
    00178 };
    00179
    00180
    00181 class ilError
    00182 {
    00183 public:
    00184         static void                     Check(void (*Callback)(const char*));
    00185         static void                     Check(void (*Callback)(ILenum));
    00186         static ILenum           Get(void);
    00187         static const char       *String(void);
    00188         static const char       *String(ILenum);
    00189
    00190 protected:
    00191
    00192 private:
    00193
    00194 };
    00195
    00196
    00197 //
    00198 // ILIMAGE
    00199 //
    00200 ilImage::ilImage()
    00201 {
    00202         this->Id = 0;
    00203         //this->iStartUp(); // This was commented out, but it needs to be somewhere...
    00204         this->iGenBind();
    00205         return;
    00206 }
    00207
    00208
    00209 ilImage::ilImage(ILconst_string FileName)
    00210 {
    00211         this->Id = 0;
    00212         //this->iStartUp(); // This was commented out, but it needs to be somewhere...
    00213         this->iGenBind();
    00214         ilLoadImage(FileName);
    00215         return;
    00216 }
    00217
    00218
    00219 ilImage::ilImage(const ilImage &Image)
    00220 {
    00221         this->Id = 0;
    00222         // this->iStartUp();
    00223         this->iGenBind();
    00224         *this = Image;
    00225         return;
    00226 }
    00227
    00228
    00229 ilImage::~ilImage()
    00230 {
    00231         if (this->Id)
    00232                 ilDeleteImages(1, &this->Id);
    00233         this->Id = 0;
    00234         return;
    00235 }
    00236
    00237
    00238 ILboolean ilImage::Load(ILconst_string FileName)
    00239 {
    00240         this->iGenBind();
    00241         return ilLoadImage(FileName);
    00242 }
    00243
    00244
    00245 ILboolean ilImage::Load(ILconst_string FileName, ILenum Type)
    00246 {
    00247         this->iGenBind();
    00248         return ilLoad(Type, FileName);
    00249 }
    00250
    00251
    00252 ILboolean ilImage::Save(ILconst_string FileName)
    00253 {
    00254         this->iGenBind();
    00255         return ilSaveImage(FileName);
    00256 }
    00257
    00258
    00259 ILboolean ilImage::Save(ILconst_string FileName, ILenum Type)
    00260 {
    00261         this->iGenBind();
    00262         return ilSave(Type, FileName);
    00263 }
    00264
    00265
    00266
    00267 //
    00268 // ImageLib functions
    00269 //
    00270 ILboolean ilImage::ActiveImage(ILuint Number)
    00271 {
    00272         if (this->Id) {
    00273                 this->Bind();
    00274                 return ilActiveImage(Number);
    00275         }
    00276         return IL_FALSE;
    00277 }
    00278
    00279
    00280 ILboolean ilImage::ActiveLayer(ILuint Number)
    00281 {
    00282         if (this->Id) {
    00283                 this->Bind();
    00284                 return ilActiveLayer(Number);
    00285         }
    00286         return IL_FALSE;
    00287 }
    00288
    00289
    00290 ILboolean ilImage::ActiveMipmap(ILuint Number)
    00291 {
    00292         if (this->Id) {
    00293                 this->Bind();
    00294                 return ilActiveMipmap(Number);
    00295         }
    00296         return IL_FALSE;
    00297 }
    00298
    00299
    00300 ILboolean ilImage::Clear()
    00301 {
    00302         if (this->Id) {
    00303                 this->Bind();
    00304                 return ilClearImage();
    00305         }
    00306         return IL_FALSE;
    00307 }
    00308
    00309
    00310 void ilImage::ClearColour(ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha)
    00311 {
    00312         ilClearColour(Red, Green, Blue, Alpha);
    00313         return;
    00314 }
    00315
    00316
    00317 ILboolean ilImage::Convert(ILenum NewFormat)
    00318 {
    00319         if (this->Id) {
    00320                 this->Bind();
    00321                 return ilConvertImage(NewFormat, IL_UNSIGNED_BYTE);
    00322         }
    00323         return IL_FALSE;
    00324 }
    00325
    00326
    00327 ILboolean ilImage::Copy(ILuint Src)
    00328 {
    00329         if (this->Id) {
    00330                 this->Bind();
    00331                 return ilCopyImage(Src);
    00332         }
    00333         return IL_FALSE;
    00334 }
    00335
    00336
    00337 ILboolean ilImage::Default()
    00338 {
    00339         if (this->Id) {
    00340                 this->Bind();
    00341                 return ilDefaultImage();
    00342         }
    00343         return IL_FALSE;
    00344 }
    00345
    00346
    00347 ILboolean ilImage::Flip()
    00348 {
    00349         if (this->Id) {
    00350                 this->Bind();
    00351                 return iluFlipImage();
    00352         }
    00353         return IL_FALSE;
    00354 }
    00355
    00356
    00357 ILboolean ilImage::SwapColours()
    00358 {
    00359         if (this->Id) {
    00360                 this->Bind();
    00361                 return iluSwapColours();
    00362         }
    00363         return IL_FALSE;
    00364 }
    00365
    00366
    00367 ILboolean ilImage::Resize(ILuint Width, ILuint Height, ILuint Depth)
    00368 {
    00369         if (this->Id) {
    00370                 this->Bind();
    00371                 return iluScale(Width, Height, Depth);
    00372         }
    00373         return IL_FALSE;
    00374 }
    00375
    00376
    00377 ILboolean ilImage::TexImage(ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data)
    00378 {
    00379         if (this->Id) {
    00380                 this->Bind();
    00381                 return ilTexImage(Width, Height, Depth, Bpp, Format, Type, Data);
    00382         }
    00383         return IL_FALSE;
    00384 }
    00385
    00386
    00387
    00388 //
    00389 // Image handling
    00390 //
    00391 void ilImage::Bind() const
    00392 {
    00393         if (this->Id)
    00394                 ilBindImage(this->Id);
    00395         return;
    00396 }
    00397
    00398 // Note:  Behaviour may be changed!
    00399 void ilImage::Bind(ILuint Image)
    00400 {
    00401         if (this->Id == Image)
    00402                 return;
    00403         this->Delete();  // Should we delete it?
    00404         this->Id = Image;
    00405         ilBindImage(this->Id);
    00406         return;
    00407 }
    00408
    00409
    00410 void ilImage::Delete()
    00411 {
    00412         if (this->Id == 0)
    00413                 return;
    00414         ilDeleteImages(1, &this->Id);
    00415         this->Id = 0;
    00416         return;
    00417 }
    00418
    00419
    00420
    00421
    00422 //
    00423 // Image characteristics
    00424 //
    00425 ILuint ilImage::Width()
    00426 {
    00427         if (this->Id) {
    00428                 this->Bind();
    00429                 return ilGetInteger(IL_IMAGE_WIDTH);
    00430         }
    00431         return 0;
    00432 }
    00433
    00434
    00435 ILuint ilImage::Height()
    00436 {
    00437         if (this->Id) {
    00438                 this->Bind();
    00439                 return ilGetInteger(IL_IMAGE_HEIGHT);
    00440         }
    00441         return 0;
    00442 }
    00443
    00444 ILuint ilImage::Depth()
    00445 {
    00446         if (this->Id) {
    00447                 this->Bind();
    00448                 return ilGetInteger(IL_IMAGE_DEPTH);
    00449         }
    00450         return 0;
    00451 }
    00452
    00453 ILubyte ilImage::Bpp()
    00454 {
    00455         if (this->Id) {
    00456                 this->Bind();
    00457                 return ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);
    00458         }
    00459         return 0;
    00460 }
    00461
    00462 ILubyte ilImage::Bitpp()
    00463 {
    00464         if (this->Id) {
    00465                 this->Bind();
    00466                 return ilGetInteger(IL_IMAGE_BITS_PER_PIXEL);
    00467         }
    00468         return 0;
    00469 }
    00470
    00471 ILenum ilImage::Format()
    00472 {
    00473         if (this->Id) {
    00474                 this->Bind();
    00475                 return ilGetInteger(IL_IMAGE_FORMAT);
    00476         }
    00477         return 0;
    00478 }
    00479
    00480 ILenum ilImage::PaletteType()
    00481 {
    00482         if (this->Id) {
    00483                 this->Bind();
    00484                 return ilGetInteger(IL_PALETTE_TYPE);
    00485         }
    00486         return 0;
    00487 }
    00488
    00489 ILenum ilImage::PaletteAlphaIndex()
    00490 {
    00491         if (this->Id) {
    00492                 this->Bind();
    00493                 return ilGetInteger(IL_PNG_ALPHA_INDEX);
    00494         }
    00495         return 0;
    00496 }
    00497
    00498 ILenum ilImage::Type()
    00499 {
    00500         if (this->Id) {
    00501                 this->Bind();
    00502                 return ilGetInteger(IL_IMAGE_TYPE);
    00503         }
    00504         return 0;
    00505 }
    00506
    00507 ILenum ilImage::NumImages()
    00508 {
    00509         if (this->Id) {
    00510                 this->Bind();
    00511                 return ilGetInteger(IL_NUM_IMAGES);
    00512         }
    00513         return 0;
    00514 }
    00515
    00516 ILenum ilImage::NumMipmaps()
    00517 {
    00518         if (this->Id) {
    00519                 this->Bind();
    00520                 return ilGetInteger(IL_NUM_MIPMAPS);
    00521         }
    00522         return 0;
    00523 }
    00524
    00525 ILuint ilImage::GetId() const
    00526 {
    00527         return this->Id;
    00528 }
    00529
    00530 ILenum ilImage::GetOrigin(void)
    00531 {
    00532     ILinfo Info;
    00533
    00534         if (this->Id) {
    00535                 this->Bind();
    00536         iluGetImageInfo(&Info);
    00537                 return Info.Origin;
    00538         }
    00539         return 0;
    00540 }
    00541
    00542 ILubyte* ilImage::GetData()
    00543 {
    00544         if (this->Id) {
    00545                 this->Bind();
    00546                 return ilGetData();
    00547         }
    00548         return 0;
    00549 }
    00550
    00551 ILubyte* ilImage::GetPalette()
    00552 {
    00553         if (this->Id) {
    00554                 this->Bind();
    00555                 return ilGetPalette();
    00556         }
    00557         return 0;
    00558 }
    00559
    00560 //
    00561 // Private members
    00562 //
    00563 /*void ilImage::iStartUp()
    00564 {
    00565         ilInit();
    00566         iluInit();
    00567         ilutInit();
    00568         return;
    00569 }*/
    00570
    00571 void ilImage::iGenBind()
    00572 {
    00573         if (this->Id == 0) {
    00574                 ilGenImages(1, &this->Id);
    00575         }
    00576         ilBindImage(this->Id);
    00577         return;
    00578 }
    00579
    00580 //
    00581 // Operators
    00582 //
    00583 ilImage& ilImage::operator = (ILuint Image)
    00584 {
    00585         if (this->Id == 0)
    00586                 this->Id = Image;
    00587         else {
    00588                 this->Bind();
    00589                 ilCopyImage(Image);
    00590         }
    00591
    00592         return *this;
    00593 }
    00594
    00595 ilImage& ilImage::operator = (const ilImage &Image)
    00596 {
    00597         if (Id == 0)
    00598                 Id = Image.GetId();
    00599         else {
    00600                 Bind();
    00601                 ilCopyImage(Image.GetId());
    00602         }
    00603
    00604         return *this;
    00605 }
    00606
    00607 //
    00608 // ILFILTERS
    00609 //
    00610 ILboolean ilFilters::Alienify(ilImage &Image)
    00611 {
    00612         Image.Bind();
    00613         return iluAlienify();
    00614 }
    00615
    00616 ILboolean ilFilters::BlurAvg(ilImage &Image, ILuint Iter)
    00617 {
    00618         Image.Bind();
    00619         return iluBlurAvg(Iter);
    00620 }
    00621
    00622 ILboolean ilFilters::BlurGaussian(ilImage &Image, ILuint Iter)
    00623 {
    00624         Image.Bind();
    00625         return iluBlurGaussian(Iter);
    00626 }
    00627
    00628 ILboolean ilFilters::Contrast(ilImage &Image, ILfloat Contrast)
    00629 {
    00630         Image.Bind();
    00631         return iluContrast(Contrast);
    00632 }
    00633
    00634 ILboolean ilFilters::EdgeDetectE(ilImage &Image)
    00635 {
    00636         Image.Bind();
    00637         return iluEdgeDetectP();
    00638 }
    00639
    00640 ILboolean ilFilters::EdgeDetectP(ilImage &Image)
    00641 {
    00642         Image.Bind();
    00643         return iluEdgeDetectP();
    00644 }
    00645
    00646 ILboolean ilFilters::EdgeDetectS(ilImage &Image)
    00647 {
    00648         Image.Bind();
    00649         return iluEdgeDetectS();
    00650 }
    00651
    00652 ILboolean ilFilters::Emboss(ilImage &Image)
    00653 {
    00654         Image.Bind();
    00655         return iluEmboss();
    00656 }
    00657
    00658 ILboolean ilFilters::Gamma(ilImage &Image, ILfloat Gamma)
    00659 {
    00660         Image.Bind();
    00661         return iluGammaCorrect(Gamma);
    00662 }
    00663
    00664 ILboolean ilFilters::Negative(ilImage &Image)
    00665 {
    00666         Image.Bind();
    00667         return iluNegative();
    00668 }
    00669
    00670 ILboolean ilFilters::Noisify(ilImage &Image, ILubyte Factor)
    00671 {
    00672         Image.Bind();
    00673         return iluNoisify(Factor);
    00674 }
    00675
    00676 ILboolean ilFilters::Pixelize(ilImage &Image, ILuint PixSize)
    00677 {
    00678         Image.Bind();
    00679         return iluPixelize(PixSize);
    00680 }
    00681
    00682 ILboolean ilFilters::Saturate(ilImage &Image, ILfloat Saturation)
    00683 {
    00684         Image.Bind();
    00685         return iluSaturate1f(Saturation);
    00686 }
    00687
    00688 ILboolean ilFilters::Saturate(ilImage &Image, ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation)
    00689 {
    00690         Image.Bind();
    00691         return iluSaturate4f(r, g, b, Saturation);
    00692 }
    00693
    00694 ILboolean ilFilters::ScaleColours(ilImage &Image, ILfloat r, ILfloat g, ILfloat b)
    00695 {
    00696         Image.Bind();
    00697         return iluScaleColours(r, g, b);
    00698 }
    00699
    00700
    00701 ILboolean ilFilters::Sharpen(ilImage &Image, ILfloat Factor, ILuint Iter)
    00702 {
    00703         Image.Bind();
    00704         return iluSharpen(Factor, Iter);
    00705 }
    00706
    00707
    00708 //
    00709 // ILOPENGL
    00710 //
    00711 #ifdef ILUT_USE_OPENGL
    00712 void ilOgl::Init()
    00713 {
    00714         ilutRenderer(ILUT_OPENGL);
    00715         return;
    00716 }
    00717
    00718
    00719 GLuint ilOgl::BindTex(ilImage &Image)
    00720 {
    00721         Image.Bind();
    00722         return ilutGLBindTexImage();
    00723 }
    00724
    00725 ILboolean ilOgl::Upload(ilImage &Image, ILuint Level)
    00726 {
    00727         Image.Bind();
    00728         return ilutGLTexImage(Level);
    00729 }
    00730
    00731
    00732 GLuint ilOgl::Mipmap(ilImage &Image)
    00733 {
    00734         Image.Bind();
    00735         return ilutGLBuildMipmaps();
    00736 }
    00737
    00738 ILboolean ilOgl::Screen()
    00739 {
    00740         return ilutGLScreen();
    00741 }
    00742
    00743
    00744 ILboolean ilOgl::Screenie()
    00745 {
    00746         return ilutGLScreenie();
    00747 }
    00748 #endif//ILUT_USE_OPENGL
    00749
    00750 //
    00751 // ILALLEGRO
    00752 //
    00753 #ifdef ILUT_USE_ALLEGRO
    00754 void ilAlleg::Init()
    00755 {
    00756         ilutRenderer(IL_ALLEGRO);
    00757         return;
    00758 }
    00759
    00760 BITMAP *ilAlleg::Convert(ilImage &Image, PALETTE Pal)
    00761 {
    00762         Image.Bind();
    00763         return ilutConvertToAlleg(Pal);
    00764 }
    00765 #endif//ILUT_USE_ALLEGRO
    00766
    00767 //
    00768 // ILWIN32
    00769 //
    00770 #ifdef ILUT_USE_WIN32
    00771 void ilWin32::Init()
    00772 {
    00773         ilutRenderer(ILUT_WIN32);
    00774         return;
    00775 }
    00776
    00777 HBITMAP ilWin32::Convert(ilImage &Image)
    00778 {
    00779         Image.Bind();
    00780         return ilutConvertToHBitmap(GetDC(NULL));
    00781 }
    00782
    00783 ILboolean ilWin32::GetClipboard(ilImage &Image)
    00784 {
    00785         Image.Bind();
    00786         return ilutGetWinClipboard();
    00787 }
    00788
    00789 void ilWin32::GetInfo(ilImage &Image, BITMAPINFO *Info)
    00790 {
    00791         Image.Bind();
    00792         ilutGetBmpInfo(Info);
    00793         return;
    00794 }
    00795
    00796 ILubyte* ilWin32::GetPadData(ilImage &Image)
    00797 {
    00798         Image.Bind();
    00799         return ilutGetPaddedData();
    00800 }
    00801
    00802 HPALETTE ilWin32::GetPal(ilImage &Image)
    00803 {
    00804         Image.Bind();
    00805         return ilutGetHPal();
    00806 }
    00807
    00808 ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType)
    00809 {
    00810         Image.Bind();
    00811         return ilutLoadResource(hInst, ID, ResourceType, IL_TYPE_UNKNOWN);
    00812 }
    00813
    00814 ILboolean ilWin32::GetResource(ilImage &Image, HINSTANCE hInst, ILint ID, char *ResourceType, ILenum Type)
    00815 {
    00816         Image.Bind();
    00817         return ilutLoadResource(hInst, ID, ResourceType, Type);
    00818 }
    00819
    00820 ILboolean ilWin32::SetClipboard(ilImage &Image)
    00821 {
    00822         Image.Bind();
    00823         return ilutSetWinClipboard();
    00824 }
    00825 #endif//ILUT_USE_WIN32
    00826
    00827 //
    00828 // ILVALIDATE
    00829 //
    00830 ILboolean ilValidate::Valid(ILenum Type, ILconst_string FileName)
    00831 {
    00832         return ilIsValid(Type, FileName);
    00833 }
    00834
    00835 ILboolean ilValidate::Valid(ILenum Type, FILE *File)
    00836 {
    00837         return ilIsValidF(Type, File);
    00838 }
    00839
    00840 ILboolean ilValidate::Valid(ILenum Type, void *Lump, ILuint Size)
    00841 {
    00842         return ilIsValidL(Type, Lump, Size);
    00843 }
    00844
    00845 //
    00846 // ILSTATE
    00847 //
    00848 ILboolean ilState::Disable(ILenum State)
    00849 {
    00850         return ilDisable(State);
    00851 }
    00852
    00853 ILboolean ilState::Enable(ILenum State)
    00854 {
    00855         return ilEnable(State);
    00856 }
    00857
    00858 void ilState::Get(ILenum Mode, ILboolean &Param)
    00859 {
    00860         ilGetBooleanv(Mode, &Param);
    00861         return;
    00862 }
    00863
    00864 void ilState::Get(ILenum Mode, ILint &Param)
    00865 {
    00866         ilGetIntegerv(Mode, &Param);
    00867         return;
    00868 }
    00869
    00870 ILboolean ilState::GetBool(ILenum Mode)
    00871 {
    00872         return ilGetBoolean(Mode);
    00873 }
    00874
    00875 ILint ilState::GetInt(ILenum Mode)
    00876 {
    00877         return ilGetInteger(Mode);
    00878 }
    00879
    00880 const char *ilState::GetString(ILenum StringName)
    00881 {
    00882         return ilGetString(StringName);
    00883 }
    00884
    00885 ILboolean ilState::IsDisabled(ILenum Mode)
    00886 {
    00887         return ilIsDisabled(Mode);
    00888 }
    00889
    00890 ILboolean ilState::IsEnabled(ILenum Mode)
    00891 {
    00892         return ilIsEnabled(Mode);
    00893 }
    00894
    00895 ILboolean ilState::Origin(ILenum Mode)
    00896 {
    00897         return ilOriginFunc(Mode);
    00898 }
    00899
    00900 void ilState::Pop()
    00901 {
    00902         ilPopAttrib();
    00903         return;
    00904 }
    00905
    00906 void ilState::Push(ILuint Bits = IL_ALL_ATTRIB_BITS)
    00907 {
    00908         ilPushAttrib(Bits);
    00909         return;
    00910 }
    00911
    00912 //
    00913 // ILERROR
    00914 //
    00915 void ilError::Check(void (*Callback)(const char*))
    00916 {
    00917         static ILenum Error;
    00918
    00919         while ((Error = ilGetError()) != IL_NO_ERROR) {
    00920                 Callback(iluErrorString(Error));
    00921         }
    00922
    00923         return;
    00924 }
    00925
    00926 void ilError::Check(void (*Callback)(ILenum))
    00927 {
    00928         static ILenum Error;
    00929
    00930         while ((Error = ilGetError()) != IL_NO_ERROR) {
    00931                 Callback(Error);
    00932         }
    00933
    00934         return;
    00935 }
    00936
    00937 ILenum ilError::Get()
    00938 {
    00939         return ilGetError();
    00940 }
    00941
    00942 const char *ilError::String()
    00943 {
    00944         return iluErrorString(ilGetError());
    00945 }
    00946
    00947 const char *ilError::String(ILenum Error)
    00948 {
    00949         return iluErrorString(Error);
    00950 }
    00951
    00952 #endif// DEVIL_CPP_WRAPPER_HPP