00001 /* 00002 Copyright © 2009-2010 Thibaut Cuvelier 00003 00004 This file is part of QExtend. 00005 00006 QExtend is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 any later version. 00010 00011 QExtend is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with QExtend. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 #include "plugin.hpp" 00021 00022 using namespace QExtend::DevIL; 00023 00024 DevILPlugin::DevILPlugin() {} 00025 DevILPlugin::~DevILPlugin() {} 00026 00027 QStringList DevILPlugin::keys() const 00028 { 00029 QStringList supported; 00030 supported << "act"; 00031 supported << "bmp"; 00032 supported << "cut"; 00033 supported << "dcx"; 00034 supported << "dds"; 00035 supported << "exr"; 00036 supported << "hdr"; 00037 supported << "ico"; 00038 supported << "icns"; 00039 supported << "gif"; 00040 supported << "jpg"; 00041 supported << "jp2"; 00042 supported << "lbm"; 00043 supported << "lif"; 00044 supported << "mdp"; 00045 supported << "pal"; 00046 supported << "pcd"; 00047 supported << "pcx"; 00048 supported << "pic"; 00049 supported << "png"; 00050 supported << "pnm"; 00051 supported << "psd"; 00052 supported << "psp"; 00053 supported << "raw"; 00054 supported << "sgi"; 00055 supported << "tga"; 00056 supported << "tif"; 00057 supported << "wal"; 00058 supported << "vtf"; 00059 return supported; 00060 } 00061 00062 QImageIOPlugin::Capabilities DevILPlugin::capabilities 00063 ( 00064 QIODevice *device, 00065 const QByteArray &format 00066 ) const 00067 { 00068 QImageIOPlugin::Capabilities cap; 00069 00070 // Unknown extension, unreadable device: how can I know whether it is supported? 00071 // I say I do not know! 00072 if ( 00073 format.isEmpty() 00074 || ! ( device->isOpen() ) 00075 ) 00076 00077 return cap; 00078 00079 // If the extension is supported for writing, it is also true for reading (at least for DevIL) 00080 if( format == "bmp" // BMP 00081 || format == "dib" // BMP 00082 || format == "dds" // DDS 00083 || format == "jpg" // JPEG 00084 || format == "jpe" // JPEG 00085 || format == "jpeg" // JPEG 00086 || format == "pal" // PAL 00087 || format == "pcx" // PCX 00088 || format == "png" // PNG 00089 || format == "pnm" // PNM 00090 || format == "pgm" // PNM 00091 || format == "pnm" // PNM 00092 || format == "ppm" // PNM 00093 || format == "raw" // RAW 00094 || format == "sgi" // SGI 00095 || format == "bw" // SGI 00096 || format == "rgb" // SGI 00097 || format == "rgba" // SGI 00098 || format == "tif" // TIFF 00099 || format == "tiff" // TIFF 00100 || format == "tga" // TGA 00101 || format == "vda" // TGA 00102 || format == "icb" // TGA 00103 || format == "vst" // TGA 00104 ) { 00105 cap |= CanRead; 00106 cap |= CanWrite; 00107 return cap; 00108 } 00109 // Is the extension only supported for reading? 00110 else if (format == "cut" // CUT 00111 || format == "dcx" // DCX 00112 || format == "exr" // EXR 00113 || format == "hdr" // HDR 00114 || format == "ico" // ICO 00115 || format == "cur" // ICO 00116 || format == "icns" // ICNS 00117 || format == "gif" // GIF 00118 || format == "jp2" // JPEG2000 00119 || format == "lbm" // LBM 00120 || format == "lif" // LIF 00121 || format == "pcd" // PCD 00122 || format == "pic" // PIC 00123 || format == "psd" // PSD 00124 || format == "pdd" // PSP 00125 || format == "psp" // PSP 00126 || format == "wal" // WAL 00127 || format == "vtf" // VTF 00128 ) { 00129 cap |= CanRead; 00130 return cap; 00131 } 00132 // Hey, I've never heard about it! 00133 else 00134 { 00135 return cap; 00136 } 00137 } 00138 00139 QImageIOHandler * DevILPlugin::create 00140 ( 00141 QIODevice *device, 00142 const QByteArray &format 00143 ) const 00144 { 00145 QImageIOHandler *handler = new DevILHandler; 00146 handler->setDevice( device ); 00147 handler->setFormat( format ); 00148 return handler; 00149 } 00150 00151 Q_EXPORT_STATIC_PLUGIN ( DevILPlugin ) 00152 Q_EXPORT_PLUGIN2 ( devil-qt, DevILPlugin ) 00153
Les sources présentées sur cette page sont libres de droits et vous pouvez les utiliser à votre convenance. Par contre, la page de présentation constitue une œuvre intellectuelle protégée par les droits d'auteur. Copyright © 2010 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site ni de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon vous encourez selon la loi jusqu'à trois ans de prison et jusqu'à 300 000 € de dommages et intérêts.