vmap/plugins/image/image.cpp

193 lines
3.4 KiB
C++
Raw Normal View History

2020-11-17 11:16:16 +00:00
/*
Copyright (C) 2001-2006, William Joseph.
All Rights Reserved.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "ifilesystem.h"
#include "iimage.h"
#include "jpeg.h"
#include "tga.h"
#include "bmp.h"
#include "pcx.h"
#include "dds.h"
#include "ktx.h"
#include "modulesystem/singletonmodule.h"
class ImageDependencies : public GlobalFileSystemModuleRef {
};
class ImageTGAAPI {
2021-08-04 20:23:18 +00:00
_QERPlugImageTable m_imagetga;
2020-11-17 11:16:16 +00:00
public:
2021-08-04 20:23:18 +00:00
typedef _QERPlugImageTable Type;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
STRING_CONSTANT(Name, "tga");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
ImageTGAAPI()
{
m_imagetga.loadImage = LoadTGA;
}
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
_QERPlugImageTable *getTable()
{
return &m_imagetga;
}
2020-11-17 11:16:16 +00:00
};
typedef SingletonModule<ImageTGAAPI> ImageTGAModule;
ImageTGAModule g_ImageTGAModule;
class ImageJPGAPI {
2021-08-04 20:23:18 +00:00
_QERPlugImageTable m_imagejpg;
2020-11-17 11:16:16 +00:00
public:
2021-08-04 20:23:18 +00:00
typedef _QERPlugImageTable Type;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
STRING_CONSTANT(Name, "jpg");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
ImageJPGAPI()
{
m_imagejpg.loadImage = LoadJPG;
}
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
_QERPlugImageTable *getTable()
{
return &m_imagejpg;
}
2020-11-17 11:16:16 +00:00
};
typedef SingletonModule<ImageJPGAPI, ImageDependencies> ImageJPGModule;
ImageJPGModule g_ImageJPGModule;
class ImageBMPAPI {
2021-08-04 20:23:18 +00:00
_QERPlugImageTable m_imagebmp;
2020-11-17 11:16:16 +00:00
public:
2021-08-04 20:23:18 +00:00
typedef _QERPlugImageTable Type;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
STRING_CONSTANT(Name, "bmp");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
ImageBMPAPI()
{
m_imagebmp.loadImage = LoadBMP;
}
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
_QERPlugImageTable *getTable()
{
return &m_imagebmp;
}
2020-11-17 11:16:16 +00:00
};
typedef SingletonModule<ImageBMPAPI, ImageDependencies> ImageBMPModule;
ImageBMPModule g_ImageBMPModule;
class ImagePCXAPI {
2021-08-04 20:23:18 +00:00
_QERPlugImageTable m_imagepcx;
2020-11-17 11:16:16 +00:00
public:
2021-08-04 20:23:18 +00:00
typedef _QERPlugImageTable Type;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
STRING_CONSTANT(Name, "pcx");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
ImagePCXAPI()
{
m_imagepcx.loadImage = LoadPCX32;
}
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
_QERPlugImageTable *getTable()
{
return &m_imagepcx;
}
2020-11-17 11:16:16 +00:00
};
typedef SingletonModule<ImagePCXAPI, ImageDependencies> ImagePCXModule;
ImagePCXModule g_ImagePCXModule;
class ImageDDSAPI {
2021-08-04 20:23:18 +00:00
_QERPlugImageTable m_imagedds;
2020-11-17 11:16:16 +00:00
public:
2021-08-04 20:23:18 +00:00
typedef _QERPlugImageTable Type;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
STRING_CONSTANT(Name, "dds");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
ImageDDSAPI()
{
m_imagedds.loadImage = LoadDDS;
}
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
_QERPlugImageTable *getTable()
{
return &m_imagedds;
}
2020-11-17 11:16:16 +00:00
};
typedef SingletonModule<ImageDDSAPI, ImageDependencies> ImageDDSModule;
ImageDDSModule g_ImageDDSModule;
class ImageKTXAPI {
2021-08-04 20:23:18 +00:00
_QERPlugImageTable m_imagektx;
2020-11-17 11:16:16 +00:00
public:
2021-08-04 20:23:18 +00:00
typedef _QERPlugImageTable Type;
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
STRING_CONSTANT(Name, "ktx");
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
ImageKTXAPI()
{
m_imagektx.loadImage = LoadKTX;
}
2020-11-17 11:16:16 +00:00
2021-08-04 20:23:18 +00:00
_QERPlugImageTable *getTable()
{
return &m_imagektx;
}
2020-11-17 11:16:16 +00:00
};
typedef SingletonModule<ImageKTXAPI, ImageDependencies> ImageKTXModule;
ImageKTXModule g_ImageKTXModule;
2021-06-02 08:49:27 +00:00
extern "C" void
#ifdef _WIN32
__declspec(dllexport)
#else
__attribute__((visibility("default")))
#endif
Radiant_RegisterModules(ModuleServer &server)
2020-11-17 11:16:16 +00:00
{
2021-08-04 20:23:18 +00:00
initialiseModule(server);
g_ImageTGAModule.selfRegister();
g_ImageJPGModule.selfRegister();
g_ImageBMPModule.selfRegister();
g_ImagePCXModule.selfRegister();
g_ImageDDSModule.selfRegister();
g_ImageKTXModule.selfRegister();
2020-11-17 11:16:16 +00:00
}