]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/image/image.cpp
Merge commit '515673c08f8718a237e90c2130a1f5294f966d6a'
[xonotic/netradiant.git] / plugins / image / image.cpp
1 /*
2 Copyright (C) 2001-2006, William Joseph.
3 All Rights Reserved.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 #include "image.h"
23
24 #include "ifilesystem.h"
25 #include "iimage.h"
26
27 #include "jpeg.h"
28 #include "tga.h"
29 #include "bmp.h"
30 #include "pcx.h"
31 #include "dds.h"
32
33
34 #include "modulesystem/singletonmodule.h"
35
36 class ImageDependencies : public GlobalFileSystemModuleRef
37 {
38 };
39
40 class ImageTGAAPI
41 {
42   _QERPlugImageTable m_imagetga;
43 public:
44   typedef _QERPlugImageTable Type;
45   STRING_CONSTANT(Name, "tga");
46
47   ImageTGAAPI()
48   {
49     m_imagetga.loadImage = LoadTGA;
50   }
51   _QERPlugImageTable* getTable()
52   {
53     return &m_imagetga;
54   }
55 };
56
57 typedef SingletonModule<ImageTGAAPI> ImageTGAModule;
58
59 ImageTGAModule g_ImageTGAModule;
60
61
62 class ImageJPGAPI
63 {
64   _QERPlugImageTable m_imagejpg;
65 public:
66   typedef _QERPlugImageTable Type;
67   STRING_CONSTANT(Name, "jpg");
68
69   ImageJPGAPI()
70   {
71     m_imagejpg.loadImage = LoadJPG;
72   }
73   _QERPlugImageTable* getTable()
74   {
75     return &m_imagejpg;
76   }
77 };
78
79 typedef SingletonModule<ImageJPGAPI, ImageDependencies> ImageJPGModule;
80
81 ImageJPGModule g_ImageJPGModule;
82
83
84 class ImageBMPAPI
85 {
86   _QERPlugImageTable m_imagebmp;
87 public:
88   typedef _QERPlugImageTable Type;
89   STRING_CONSTANT(Name, "bmp");
90
91   ImageBMPAPI()
92   {
93     m_imagebmp.loadImage = LoadBMP;
94   }
95   _QERPlugImageTable* getTable()
96   {
97     return &m_imagebmp;
98   }
99 };
100
101 typedef SingletonModule<ImageBMPAPI, ImageDependencies> ImageBMPModule;
102
103 ImageBMPModule g_ImageBMPModule;
104
105
106 class ImagePCXAPI
107 {
108   _QERPlugImageTable m_imagepcx;
109 public:
110   typedef _QERPlugImageTable Type;
111   STRING_CONSTANT(Name, "pcx");
112
113   ImagePCXAPI()
114   {
115     m_imagepcx.loadImage = LoadPCX32;
116   }
117   _QERPlugImageTable* getTable()
118   {
119     return &m_imagepcx;
120   }
121 };
122
123 typedef SingletonModule<ImagePCXAPI, ImageDependencies> ImagePCXModule;
124
125 ImagePCXModule g_ImagePCXModule;
126
127
128 class ImageDDSAPI
129 {
130   _QERPlugImageTable m_imagedds;
131 public:
132   typedef _QERPlugImageTable Type;
133   STRING_CONSTANT(Name, "dds");
134
135   ImageDDSAPI()
136   {
137     m_imagedds.loadImage = LoadDDS;
138   }
139   _QERPlugImageTable* getTable()
140   {
141     return &m_imagedds;
142   }
143 };
144
145 typedef SingletonModule<ImageDDSAPI, ImageDependencies> ImageDDSModule;
146
147 ImageDDSModule g_ImageDDSModule;
148
149
150 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules(ModuleServer& server)
151 {
152   initialiseModule(server);
153
154   g_ImageTGAModule.selfRegister();
155   g_ImageJPGModule.selfRegister();
156   g_ImageBMPModule.selfRegister();
157   g_ImagePCXModule.selfRegister();
158   g_ImageDDSModule.selfRegister();
159 }