void imageproc::init() { unsigned int i; RegisterStaticModules(); InitializeMagick(NULL); // let's output a startup banner with available image type support ExceptionInfo exception; MagickInfo ** arr = GetMagickInfoArray( &exception ); std::stringstream ss; ss << "GraphicsMagick engine initialized with support for: [ "; bool first = true; while (arr && *arr) { if (!first) ss << ", "; first = false; ss << (*arr)->name; char * mt = MagickToMime( (*arr)->name ); if (mt) { s_imgFormats[(*arr)->name] = std::string(mt); ss << " (" << mt << ")"; free(mt); } arr++; } ss << " ]"; g_bpCoreFunctions->log(BP_INFO, ss.str().c_str()); ss.str(""); ss << "Supported transformations: [ "; first = true; for (i = 0; i < trans::num(); i++) { if (!first) ss << ", "; first = false; ss << trans::get(i)->name; } ss << " ]"; g_bpCoreFunctions->log(BP_INFO, ss.str().c_str()); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % L i s t M o d u l e M a p % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Method ListModuleMap lists the module alias info to a file in the XML % format used by modules.mgk. True is returned on success. % % The format of the ListModuleMap method is: % % MagickPassFail ListModuleMap(FILE *file,ExceptionInfo *exception) % % A description of each parameter follows. % % o file: An pointer to a FILE. % % o exception: Return any errors or warnings in this structure. % % */ MagickExport MagickPassFail ListModuleMap(FILE *file,ExceptionInfo *exception) { MagickInfo **magick_array; int i; if (file == (const FILE *) NULL) file=stdout; magick_array=GetMagickInfoArray(exception); if ((!magick_array) || (exception->severity > UndefinedException)) return MagickFail; (void) fprintf(file, "<?xml version=\"1.0\"?>\n"); (void) fprintf(file, "<!-- %s -->\n",GetMagickCopyright()); (void) fprintf(file, "<!-- Magick Module Alias Map (modules.mgk) -->\n"); (void) fprintf(file, "<modulemap>\n"); for (i=0; magick_array[i] != 0; i++) { if (LocaleCompare(magick_array[i]->name,magick_array[i]->module) != 0) { (void) fprintf(file, " <module magick=\"%s\" name=\"%s\" />\n", magick_array[i]->name, (magick_array[i]->module == NULL ? "(null)" : magick_array[i]->module)); } } (void) fprintf(file, "</modulemap>\n"); (void) fflush(file); MagickFreeMemory(magick_array); return(MagickPass); }
FormatsManager::FormatsManager() { m_fmts.insert(FormatsManager::AI, QStringList() << "ai"); m_fmts.insert(FormatsManager::BMP, QStringList() << "bmp"); m_fmts.insert(FormatsManager::CVG, QStringList() << "cvg"); m_fmts.insert(FormatsManager::EPS, QStringList() << "eps" << "epsf" << "epsi" << "eps2" << "eps3" << "epi" << "ept"); m_fmts.insert(FormatsManager::GIF, QStringList() << "gif"); m_fmts.insert(FormatsManager::JPEG, QStringList() << "jpg" << "jpeg"); m_fmts.insert(FormatsManager::ORA, QStringList() << "ora"); m_fmts.insert(FormatsManager::PAT, QStringList() << "pat"); m_fmts.insert(FormatsManager::PCT, QStringList() << "pct" << "pic" << "pict"); m_fmts.insert(FormatsManager::PDF, QStringList() << "pdf"); m_fmts.insert(FormatsManager::PGF, QStringList() << "pgf"); m_fmts.insert(FormatsManager::PNG, QStringList() << "png"); m_fmts.insert(FormatsManager::PS, QStringList() << "ps"); m_fmts.insert(FormatsManager::PSD, QStringList() << "psd"); m_fmts.insert(FormatsManager::SVG, QStringList() << "svg" << "svgz"); m_fmts.insert(FormatsManager::TIFF, QStringList() << "tif" << "tiff"); m_fmts.insert(FormatsManager::UNICONV, QStringList() << "cdt" << "ccx" << "cmx" << "aff" << "sk" << "sk1" << "plt" << "dxf" << "dst" << "pes" << "exp" << "pcs"); m_fmts.insert(FormatsManager::WMF, QStringList() << "wmf"); m_fmts.insert(FormatsManager::WPG, QStringList() << "wpg"); m_fmts.insert(FormatsManager::XFIG, QStringList() << "fig"); m_fmts.insert(FormatsManager::XPM, QStringList() << "xpm"); #ifdef GMAGICK_FOUND QStringList gmagickformats; InitializeMagick(0); ExceptionInfo exception; MagickInfo **magick_array; magick_array=GetMagickInfoArray(&exception); if (!magick_array) return; for (int i=0; magick_array[i] != 0; i++) { if (magick_array[i]->stealth) continue; gmagickformats<<QString(magick_array[i]->name).toLower(); } MagickFree(magick_array); //qDebug()<<gmagickformats; gmagickformats.removeAll("eps"); gmagickformats.removeAll("pdf"); gmagickformats.removeAll("pict"); gmagickformats.removeAll("ps"); gmagickformats.removeAll("psd"); gmagickformats.removeAll("svg"); gmagickformats.removeAll("svgz"); gmagickformats.removeAll("tiff"); gmagickformats.removeAll("wmf"); gmagickformats.removeAll("wpg"); m_fmts.insert(FormatsManager::GMAGICK, gmagickformats); #endif m_fmtNames[FormatsManager::AI] = QObject::tr("Adobe Illustrator"); m_fmtNames[FormatsManager::BMP] = QObject::tr("BMP"); m_fmtNames[FormatsManager::CVG] = QObject::tr("Calamus Vector Graphics"); m_fmtNames[FormatsManager::EPS] = QObject::tr("Encapsulated PostScript"); m_fmtNames[FormatsManager::GIF] = QObject::tr("GIF"); m_fmtNames[FormatsManager::JPEG] = QObject::tr("JPEG"); m_fmtNames[FormatsManager::ORA] = QObject::tr("Open Raster"); m_fmtNames[FormatsManager::PAT] = QObject::tr("Pattern Files"); m_fmtNames[FormatsManager::PDF] = QObject::tr("PDF Document"); m_fmtNames[FormatsManager::PGF] = QObject::tr("PGF"); m_fmtNames[FormatsManager::PNG] = QObject::tr("PNG"); m_fmtNames[FormatsManager::PSD] = QObject::tr("Adobe Photoshop"); m_fmtNames[FormatsManager::PS] = QObject::tr("PostScript"); m_fmtNames[FormatsManager::SVG] = QObject::tr("Scalable Vector Graphics"); m_fmtNames[FormatsManager::TIFF] = QObject::tr("TIFF"); m_fmtNames[FormatsManager::WMF] = QObject::tr("Windows Meta File"); m_fmtNames[FormatsManager::WPG] = QObject::tr("WordPerfect Graphics"); m_fmtNames[FormatsManager::XFIG] = QObject::tr("Xfig File"); m_fmtNames[FormatsManager::XPM] = QObject::tr("XPM"); #ifdef GMAGICK_FOUND m_fmtNames[FormatsManager::GMAGICK] = QObject::tr("GraphicsMagick"); #endif m_fmtNames[FormatsManager::PCT] = QObject::tr("Macintosh Pict"); m_fmtNames[FormatsManager::QT] = QObject::tr("Qt Supported File"); m_fmtNames[FormatsManager::UNICONV] = QObject::tr("UniConvertor"); m_fmtMimeTypes.insert(FormatsManager::AI, QStringList() << "application/illustrator"); m_fmtMimeTypes.insert(FormatsManager::CVG, QStringList() << ""); m_fmtMimeTypes.insert(FormatsManager::EPS, QStringList() << "application/postscript"); m_fmtMimeTypes.insert(FormatsManager::GIF, QStringList() << "image/gif"); m_fmtMimeTypes.insert(FormatsManager::JPEG, QStringList() << "image/jpeg"); m_fmtMimeTypes.insert(FormatsManager::ORA, QStringList() << ""); m_fmtMimeTypes.insert(FormatsManager::PAT, QStringList() << ""); m_fmtMimeTypes.insert(FormatsManager::PCT, QStringList() << ""); m_fmtMimeTypes.insert(FormatsManager::PDF, QStringList() << "application/pdf"); m_fmtMimeTypes.insert(FormatsManager::PGF, QStringList() << "image/pgf"); m_fmtMimeTypes.insert(FormatsManager::PNG, QStringList() << "image/png"); m_fmtMimeTypes.insert(FormatsManager::PS, QStringList() << "application/postscript"); m_fmtMimeTypes.insert(FormatsManager::PSD, QStringList() << "application/photoshop"); m_fmtMimeTypes.insert(FormatsManager::QT, QStringList() << ""); m_fmtMimeTypes.insert(FormatsManager::SVG, QStringList() << "image/svg+xml"); m_fmtMimeTypes.insert(FormatsManager::TIFF, QStringList() << "image/tiff"); m_fmtMimeTypes.insert(FormatsManager::WMF, QStringList() << "image/wmf"); m_fmtMimeTypes.insert(FormatsManager::WPG, QStringList() << ""); m_fmtMimeTypes.insert(FormatsManager::XFIG, QStringList() << "image/x-xfig"); m_fmtMimeTypes.insert(FormatsManager::XPM, QStringList() << "image/xpm "); QMapIterator<int, QStringList> i(m_fmts); while (i.hasNext()) { i.next(); m_fmtList << i.value().first().toUpper(); } m_qtSupportedImageFormats = QImageReader::supportedImageFormats(); QStringList qtFmts; for (int qf = 0; qf < m_qtSupportedImageFormats.count(); qf++) { QString fmt = m_qtSupportedImageFormats[qf]; bool found = false; QMapIterator<int, QStringList> i(m_fmts); while (i.hasNext()) { i.next(); if (i.value().contains(fmt)) found = true; } if (!found) qtFmts.append(fmt); } m_fmts.insert(FormatsManager::QT, qtFmts); m_supportedImageFormats = m_qtSupportedImageFormats; updateSupportedImageFormats(m_supportedImageFormats); }
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % L i s t M a g i c k I n f o % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % ListMagickInfo() lists the image formats to a file. % % The format of the ListMagickInfo method is: % % MagickPassFail ListMagickInfo(FILE *file,ExceptionInfo *exception) % % A description of each parameter follows. % % o file: A file handle. % % o exception: Return any errors or warnings in this structure. % % */ MagickExport MagickPassFail ListMagickInfo(FILE *file,ExceptionInfo *exception) { MagickInfo **magick_array; int i; if (file == (FILE *) NULL) file=stdout; magick_array=GetMagickInfoArray(exception); if (!magick_array) return False; (void) fprintf(file," Format L Mode Description\n"); (void) fprintf(file,"--------------------------------------------------------" "------------------------\n"); for (i=0; magick_array[i] != 0; i++) { if (magick_array[i]->stealth) continue; (void) fprintf(file,"%9s %c %c%c%c", magick_array[i]->name ? magick_array[i]->name : "", (magick_array[i]->coder_class == PrimaryCoderClass ? 'P' : (magick_array[i]->coder_class == StableCoderClass ? 'S' : 'U')), (magick_array[i]->decoder ? 'r' : '-'), (magick_array[i]->encoder ? 'w' : '-'), ((magick_array[i]->encoder && magick_array[i]->adjoin) ? '+' : '-')); if (magick_array[i]->description != (char *) NULL) (void) fprintf(file," %.1024s",magick_array[i]->description); if (magick_array[i]->version != (char *) NULL) (void) fprintf(file," (%.1024s)",magick_array[i]->version); (void) fprintf(file,"\n"); if (magick_array[i]->note != (char *) NULL) { char **text; text=StringToList(magick_array[i]->note); if (text != (char **) NULL) { register long j; for (j=0; text[j] != (char *) NULL; j++) { (void) fprintf(file," %.1024s\n",text[j]); MagickFreeMemory(text[j]); } MagickFreeMemory(text); } } } (void) fprintf(file,"\n Meaning of 'L': P=Primary, S=Stable, U=Unstable\n"); (void) fflush(file); MagickFreeMemory(magick_array); return(MagickPass); }