]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/image/image.cpp
fcfdd01875510561f8db08617b2cb2aec269d05a
[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         m_imagetga.loadImage = LoadTGA;
49 }
50 _QERPlugImageTable* getTable(){
51         return &m_imagetga;
52 }
53 };
54
55 typedef SingletonModule<ImageTGAAPI> ImageTGAModule;
56
57 ImageTGAModule g_ImageTGAModule;
58
59
60 class ImageJPGAPI
61 {
62 _QERPlugImageTable m_imagejpg;
63 public:
64 typedef _QERPlugImageTable Type;
65 STRING_CONSTANT( Name, "jpg" );
66
67 ImageJPGAPI(){
68         m_imagejpg.loadImage = LoadJPG;
69 }
70 _QERPlugImageTable* getTable(){
71         return &m_imagejpg;
72 }
73 };
74
75 typedef SingletonModule<ImageJPGAPI, ImageDependencies> ImageJPGModule;
76
77 ImageJPGModule g_ImageJPGModule;
78
79
80 class ImageBMPAPI
81 {
82 _QERPlugImageTable m_imagebmp;
83 public:
84 typedef _QERPlugImageTable Type;
85 STRING_CONSTANT( Name, "bmp" );
86
87 ImageBMPAPI(){
88         m_imagebmp.loadImage = LoadBMP;
89 }
90 _QERPlugImageTable* getTable(){
91         return &m_imagebmp;
92 }
93 };
94
95 typedef SingletonModule<ImageBMPAPI, ImageDependencies> ImageBMPModule;
96
97 ImageBMPModule g_ImageBMPModule;
98
99
100 class ImagePCXAPI
101 {
102 _QERPlugImageTable m_imagepcx;
103 public:
104 typedef _QERPlugImageTable Type;
105 STRING_CONSTANT( Name, "pcx" );
106
107 ImagePCXAPI(){
108         m_imagepcx.loadImage = LoadPCX32;
109 }
110 _QERPlugImageTable* getTable(){
111         return &m_imagepcx;
112 }
113 };
114
115 typedef SingletonModule<ImagePCXAPI, ImageDependencies> ImagePCXModule;
116
117 ImagePCXModule g_ImagePCXModule;
118
119
120 class ImageDDSAPI
121 {
122 _QERPlugImageTable m_imagedds;
123 public:
124 typedef _QERPlugImageTable Type;
125 STRING_CONSTANT( Name, "dds" );
126
127 ImageDDSAPI(){
128         m_imagedds.loadImage = LoadDDS;
129 }
130 _QERPlugImageTable* getTable(){
131         return &m_imagedds;
132 }
133 };
134
135 typedef SingletonModule<ImageDDSAPI, ImageDependencies> ImageDDSModule;
136
137 ImageDDSModule g_ImageDDSModule;
138
139
140 extern "C" void RADIANT_DLLEXPORT Radiant_RegisterModules( ModuleServer& server ){
141         initialiseModule( server );
142
143         g_ImageTGAModule.selfRegister();
144         g_ImageJPGModule.selfRegister();
145         g_ImageBMPModule.selfRegister();
146         g_ImagePCXModule.selfRegister();
147         g_ImageDDSModule.selfRegister();
148 }