Initial public release.
[OpenCLIPER] / DevIL / patch-include_IL_devil_cpp_wrapper.hpp
1 /* Copyright (C) 2018 Federico Simmross Wattenberg,
2  *                    Manuel Rodríguez Cayetano,
3  *                    Javier Royuela del Val,
4  *                    Elena Martín González,
5  *                    Elisa Moya Sáez,
6  *                    Marcos Martín Fernández and
7  *                    Carlos Alberola López
8  *
9  * This file is part of OpenCLIPER.
10  *
11  * OpenCLIPER is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; version 3 of the License.
14  *
15  * OpenCLIPER is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with OpenCLIPER; If not, see <http://www.gnu.org/licenses/>.
22  *
23  *
24  *  Contact:
25  *
26  *  Federico Simmross Wattenberg
27  *  E.T.S.I. Telecomunicación
28  *  Universidad de Valladolid
29  *  Paseo de Belén 15
30  *  47011 Valladolid, Spain.
31  *  fedsim@tel.uva.es
32  */
33 --- include/IL/devil_cpp_wrapper.hpp.orig       2009-03-08 08:10:08.000000000 +0100
34 +++ include/IL/devil_cpp_wrapper.hpp    2016-11-15 21:33:55.069217649 +0100
35 @@ -13,6 +13,7 @@
36  
37         ILboolean       Load(ILconst_string);
38         ILboolean       Load(ILconst_string, ILenum);
39 +  ILboolean       LoadL(ILenum Type, const void* Lump, ILuint Size);                   
40         ILboolean       Save(ILconst_string);
41         ILboolean       Save(ILconst_string, ILenum);
42  
43 @@ -29,7 +30,12 @@
44         ILboolean       SwapColours(void);
45         ILboolean       Resize(ILuint, ILuint, ILuint);
46         ILboolean       TexImage(ILuint, ILuint, ILuint, ILubyte, ILenum, ILenum, void*);
47 -       
48 +        ILuint          CopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, 
49 +                                  ILuint Width, ILuint Height, ILuint Depth, 
50 +                                  ILenum Format, ILenum Type, void *Data);
51 +        ILuint          SetPixels(ILuint XOff, ILuint YOff, ILuint ZOff, 
52 +                                  ILuint Width, ILuint Height, ILuint Depth, 
53 +                                  ILenum Format, ILenum Type, void *Data);
54         // Image handling
55         void            Bind(void) const;
56         void            Bind(ILuint);
57 @@ -52,6 +58,7 @@
58         ILuint          GetId(void) const;
59      ILenum      GetOrigin(void);
60         ILubyte         *GetData(void);
61 +  ILboolean    SetData(ILubyte *Data);
62         ILubyte         *GetPalette(void);
63  
64         // Rendering
65 @@ -248,6 +255,11 @@
66         return ilLoad(Type, FileName);
67  }
68  
69 +ILboolean ilImage::LoadL(ILenum Type, const void* Lump, ILuint Size)
70 +{
71 +  this->iGenBind();
72 +  return ilLoadL(Type, Lump, Size);
73 +}
74  
75  ILboolean ilImage::Save(ILconst_string FileName)
76  {
77 @@ -383,7 +395,30 @@
78         return IL_FALSE;
79  }
80  
81 -
82 +ILuint ilImage::CopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff, 
83 +                          ILuint Width, ILuint Height, ILuint Depth, 
84 +                          ILenum Format, ILenum Type, void *Data) 
85 +{
86 +  if (this->Id) {
87 +    this->Bind();
88 +    return ilCopyPixels(XOff, YOff, ZOff, Width, Height, Depth, 
89 +                       Format, Type, Data);
90 +  }
91 +  return IL_FALSE;
92 +}
93 +
94 +ILuint ilImage::SetPixels(ILuint XOff, ILuint YOff, ILuint ZOff, 
95 +                          ILuint Width, ILuint Height, ILuint Depth, 
96 +                          ILenum Format, ILenum Type, void *Data) 
97 +{
98 +  if (this->Id) {
99 +    this->Bind();
100 +    ilSetPixels(XOff, YOff, ZOff, Width, Height, Depth, 
101 +                       Format, Type, Data);
102 +    return IL_TRUE;
103 +  }
104 +  return IL_FALSE;
105 +}
106  
107  //
108  // Image handling
109 @@ -548,6 +583,15 @@
110         return 0;
111  }
112  
113 +ILboolean ilImage::SetData(ILubyte *Data)
114 +{
115 +  if (this->Id) {
116 +    this->Bind();
117 +    return ilSetData(Data);
118 +  }
119 +  return IL_FALSE;
120 +}
121 +
122  ILubyte* ilImage::GetPalette()
123  {
124         if (this->Id) {