24#include <magick/api.h>
27#include <tqfileinfo.h>
30#include <tdeversion.h>
32#include <tdeapplication.h>
35#include <tdeio/netaccess.h>
40#include "kis_global.h"
44#include "kis_undo_adapter.h"
45#include "kis_image_magick_converter.h"
46#include "kis_meta_registry.h"
47#include "kis_colorspace_factory_registry.h"
48#include "kis_iterators_pixel.h"
49#include "kis_colorspace.h"
50#include "kis_profile.h"
51#include "kis_annotation.h"
52#include "kis_paint_layer.h"
53#include "kis_group_layer.h"
54#include "kis_paint_device.h"
56#include "../../../config.h"
60 const TQ_UINT8 PIXEL_BLUE = 0;
61 const TQ_UINT8 PIXEL_GREEN = 1;
62 const TQ_UINT8 PIXEL_RED = 2;
63 const TQ_UINT8 PIXEL_ALPHA = 3;
65 static const TQ_UINT8 PIXEL_CYAN = 0;
66 static const TQ_UINT8 PIXEL_MAGENTA = 1;
67 static const TQ_UINT8 PIXEL_YELLOW = 2;
68 static const TQ_UINT8 PIXEL_BLACK = 3;
69 static const TQ_UINT8 PIXEL_CMYK_ALPHA = 4;
71 static const TQ_UINT8 PIXEL_GRAY = 0;
72 static const TQ_UINT8 PIXEL_GRAY_ALPHA = 1;
78 TQString getColorSpaceName(ColorspaceType type,
unsigned long imageDepth = 8)
81 if (type == GRAYColorspace) {
84 else if ( imageDepth == 16 )
87 else if (type == CMYKColorspace) {
90 else if ( imageDepth == 16 ) {
94 else if (type == LABColorspace) {
95 kdDebug(41008) <<
"Lab!\n";
98 else if (type == RGBColorspace || type == sRGBColorspace || type == TransparentColorspace) {
101 else if (imageDepth == 16)
108 ColorspaceType getColorTypeforColorSpace( KisColorSpace * cs )
110 if ( cs->id() == KisID(
"GRAYA") || cs->id() == KisID(
"GRAYA16") )
return GRAYColorspace;
111 if ( cs->id() == KisID(
"RGBA") || cs->id() == KisID(
"RGBA16") )
return RGBColorspace;
112 if ( cs->id() == KisID(
"CMYK") || cs->id() == KisID(
"CMYK16") )
return CMYKColorspace;
113 if ( cs->id() == KisID(
"LABA") )
return LABColorspace;
115 kdDebug(41008) <<
"Cannot export images in " + cs->id().name() +
" yet.\n";
116 return RGBColorspace;
120 KisProfile * getProfileForProfileInfo(
const Image * image)
126 if (image->profiles == NULL)
130 const StringInfo *profile;
134 ResetImageProfileIterator(image);
135 for (name = GetNextImageProfile(image); name != (
char *) NULL; )
137 profile = GetImageProfile(image, name);
138 if (profile == (StringInfo *) NULL)
142 if (TQString::compare(name,
"icc") == 0) {
144 rawdata.resize(profile->length);
145 memcpy(rawdata.data(), profile->datum, profile->length);
147 p =
new KisProfile(rawdata);
151 name = GetNextImageProfile(image);
157 void setAnnotationsForImage(
const Image * src, KisImageSP image)
162 if (src->profiles == NULL)
165 const char *name = 0;
166 const StringInfo *profile;
167 KisAnnotation* annotation = 0;
170 ResetImageProfileIterator(src);
171 while((name = GetNextImageProfile(src))) {
172 profile = GetImageProfile(src, name);
173 if (profile == (StringInfo *) NULL)
177 if (TQString::compare(name,
"icc") == 0)
181 rawdata.resize(profile->length);
182 memcpy(rawdata.data(), profile->datum, profile->length);
184 annotation =
new KisAnnotation(TQString(name),
"", rawdata);
185 TQ_CHECK_PTR(annotation);
187 image -> addAnnotation(annotation);
195#if MagickLibVersion >= 0x621
196 const ImageAttribute * attr;
197 ResetImageAttributeIterator(src);
198 while ( (attr = GetNextImageAttribute(src)) ) {
200 ImageAttribute * attr = src -> attributes;
204 int len = strlen(attr -> value) + 1;
206 memcpy(rawdata.data(), attr -> value, len);
208 annotation =
new KisAnnotation(
209 TQString(
"chalk_attribute:%1").arg(TQString(attr -> key)),
"", rawdata);
210 TQ_CHECK_PTR(annotation);
212 image -> addAnnotation(annotation);
213#if MagickLibVersion < 0x620
222 void exportAnnotationsForImage(Image * dst, vKisAnnotationSP_it& it, vKisAnnotationSP_it& annotationsEnd)
227 while(it != annotationsEnd) {
228 if (!(*it) || (*it) -> type() == TQString()) {
229 kdDebug(41008) <<
"Warning: empty annotation" << endl;
234 kdDebug(41008) <<
"Trying to store annotation of type " << (*it) -> type() <<
" of size " << (*it) -> annotation() . size() << endl;
236 if ((*it) -> type().startsWith(
"chalk_attribute:")) {
237 if (!SetImageAttribute(dst,
238 (*it) -> type().mid(strlen(
"chalk_attribute:")).ascii(),
239 (*it) -> annotation() . data()) ) {
240 kdDebug(41008) <<
"Storing of attribute " << (*it) -> type() <<
"failed!\n";
243 if (!ProfileImage(dst, (*it) -> type().ascii(),
244 (
unsigned char*)(*it) -> annotation() . data(),
245 (*it) -> annotation() . size(), MagickFalse)) {
246 kdDebug(41008) <<
"Storing failed!" << endl;
255 void InitGlobalMagick()
257 static bool init =
false;
260 TDEApplication *app = TDEApplication::kApplication();
262 InitializeMagick(*app -> argv());
263 atexit(DestroyMagick);
279 MagickBooleanType monitor(
const char *text,
const ExtendedSignedIntegralType,
const ExtendedUnsignedIntegralType, ExceptionInfo *)
281 TDEApplication *app = TDEApplication::kApplication();
285 if (app -> hasPendingEvents())
286 app -> processEvents();
288 printf(
"%s\n", text);
292 unsigned int monitor(
const char *text,
const ExtendedSignedIntegralType,
const ExtendedUnsignedIntegralType, ExceptionInfo *)
294 TDEApplication *app = TDEApplication::kApplication();
298 if (app -> hasPendingEvents())
299 app -> processEvents();
301 printf(
"%s\n", text);
308KisImageMagickConverter::KisImageMagickConverter(KisDoc *doc, KisUndoAdapter *adapter)
312 SetMonitorHandler(monitor);
316KisImageMagickConverter::~KisImageMagickConverter()
320KisImageBuilder_Result KisImageMagickConverter::decode(
const KURL& uri,
bool isBlob)
329 return KisImageBuilder_RESULT_INTR;
332 GetExceptionInfo(&ei);
333 ii = CloneImageInfo(0);
338 Q_ASSERT(uri.isEmpty());
339 images = BlobToImage(ii, &m_data[0], m_data.size(), &ei);
342 tqstrncpy(ii -> filename, TQFile::encodeName(uri.path()), MaxTextExtent - 1);
344 if (ii -> filename[MaxTextExtent - 1]) {
345 emit notifyProgressError();
346 return KisImageBuilder_RESULT_PATH;
349 images = ReadImage(ii, &ei);
353 if (ei.severity != UndefinedException)
357 DestroyImageInfo(ii);
358 DestroyExceptionInfo(&ei);
359 emit notifyProgressError();
360 return KisImageBuilder_RESULT_FAILURE;
363 emit notifyProgressStage(i18n(
"Importing..."), 0);
367 while ((image = RemoveFirstImageFromList(&images))) {
368 ViewInfo *vi = OpenCacheView(image);
371 unsigned long imageDepth = image->depth;
372 kdDebug(41008) <<
"Image depth: " << imageDepth <<
"\n";
375 KisColorSpace * cs = 0;
376 ColorspaceType colorspaceType;
379 if (GetImageType(image, &ei) == GrayscaleType || GetImageType(image, &ei) == GrayscaleMatteType) {
382 else if ( imageDepth == 16 )
384 colorspaceType = GRAYColorspace;
387 colorspaceType = image->colorspace;
388 csName = getColorSpaceName(image -> colorspace, imageDepth);
391 kdDebug(41008) <<
"image has " << csName <<
" colorspace\n";
393 KisProfile * profile = getProfileForProfileInfo(image);
396 kdDebug(41008) <<
"image has embedded profile: " << profile -> productName() <<
"\n";
397 cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace(csName, profile);
400 cs = KisMetaRegistry::instance()->csRegistry()->getColorSpace(KisID(csName,
""),
"");
403 kdDebug(41008) <<
"Chalk does not support colorspace " << image -> colorspace <<
"\n";
406 DestroyExceptionInfo(&ei);
407 DestroyImageList(images);
408 DestroyImageInfo(ii);
409 emit notifyProgressError();
410 return KisImageBuilder_RESULT_UNSUPPORTED_COLORSPACE;
414 m_img =
new KisImage(m_doc->undoAdapter(), image -> columns, image -> rows, cs,
"built image");
416 m_img->blockSignals(
true);
419 setAnnotationsForImage(image, m_img);
422 if (image -> columns && image -> rows) {
425 TQ_UINT8 opacity = OPACITY_OPAQUE;
426 const ImageAttribute * attr = GetImageAttribute(image,
"[layer-opacity]");
428 opacity = TQ_UINT8_MAX - Downscale(TQString(attr->value).toInt());
431 KisPaintLayerSP layer = 0;
433 attr = GetImageAttribute(image,
"[layer-name]");
435 layer =
new KisPaintLayer(m_img, attr->value, opacity);
438 layer =
new KisPaintLayer(m_img, m_img -> nextLayerName(), opacity);
444 TQ_INT32 x_offset = 0;
445 TQ_INT32 y_offset = 0;
447 attr = GetImageAttribute(image,
"[layer-xpos]");
449 x_offset = TQString(attr->value).toInt();
452 attr = GetImageAttribute(image,
"[layer-ypos]");
454 y_offset = TQString(attr->value).toInt();
458 for (TQ_UINT32 y = 0; y < image->rows; y ++)
460 const PixelPacket *pp = AcquireCacheView(vi, 0, y, image->columns, 1, &ei);
465 DestroyImageList(images);
466 DestroyImageInfo(ii);
467 DestroyExceptionInfo(&ei);
468 emit notifyProgressError();
469 return KisImageBuilder_RESULT_FAILURE;
472 IndexPacket * indexes = GetCacheViewIndexes(vi);
474 KisHLineIteratorPixel hiter = layer->paintDevice()->createHLineIterator(0, y, image->columns,
true);
476 if (colorspaceType== CMYKColorspace) {
477 if (imageDepth == 8) {
479 while (!hiter.isDone())
481 TQ_UINT8 *ptr= hiter.rawData();
482 *(ptr++) = Downscale(pp->red);
483 *(ptr++) = Downscale(pp->green);
484 *(ptr++) = Downscale(pp->blue);
485 *(ptr++) = Downscale(indexes[x]);
488 if (image->matte != MagickFalse) {
490 if (image->matte ==
true) {
492 *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
495 *(ptr++) = OPACITY_OPAQUE;
503 else if (colorspaceType == LABColorspace) {
504 while(! hiter.isDone())
506 TQ_UINT16 *ptr =
reinterpret_cast<TQ_UINT16 *
>(hiter.rawData());
508 *(ptr++) = ScaleQuantumToShort(pp->red);
509 *(ptr++) = ScaleQuantumToShort(pp->green);
510 *(ptr++) = ScaleQuantumToShort(pp->blue);
511 *(ptr++) = 65535 - ScaleQuantumToShort(pp->opacity);
517 else if (colorspaceType == RGBColorspace ||
518 colorspaceType == sRGBColorspace ||
519 colorspaceType == TransparentColorspace)
521 if (imageDepth == 8) {
522 while(! hiter.isDone())
524 TQ_UINT8 *ptr= hiter.rawData();
526 *(ptr++) = Downscale(pp->blue);
527 *(ptr++) = Downscale(pp->green);
528 *(ptr++) = Downscale(pp->red);
529 *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
535 else if (imageDepth == 16) {
536 while(! hiter.isDone())
538 TQ_UINT16 *ptr =
reinterpret_cast<TQ_UINT16 *
>(hiter.rawData());
540 *(ptr++) = ScaleQuantumToShort(pp->blue);
541 *(ptr++) = ScaleQuantumToShort(pp->green);
542 *(ptr++) = ScaleQuantumToShort(pp->red);
543 *(ptr++) = 65535 - ScaleQuantumToShort(pp->opacity);
550 else if ( colorspaceType == GRAYColorspace) {
551 if (imageDepth == 8) {
552 while(! hiter.isDone())
554 TQ_UINT8 *ptr= hiter.rawData();
556 *(ptr++) = Downscale(pp->blue);
557 *(ptr++) = OPACITY_OPAQUE - Downscale(pp->opacity);
563 else if (imageDepth == 16) {
564 while(! hiter.isDone())
566 TQ_UINT16 *ptr =
reinterpret_cast<TQ_UINT16 *
>(hiter.rawData());
568 *(ptr++) = ScaleQuantumToShort(pp->blue);
569 *(ptr++) = 65535 - ScaleQuantumToShort(pp->opacity);
577 emit notifyProgress(y * 100 / image->rows);
582 DestroyImageList(images);
583 DestroyImageInfo(ii);
584 DestroyExceptionInfo(&ei);
586 return KisImageBuilder_RESULT_INTR;
589 m_img->addLayer(layer.data(), m_img->rootLayer());
590 layer->paintDevice()->move(x_offset, y_offset);
593 emit notifyProgressDone();
598 emit notifyProgressDone();
599 DestroyImageList(images);
600 DestroyImageInfo(ii);
601 DestroyExceptionInfo(&ei);
602 return KisImageBuilder_RESULT_OK;
605 KisImageBuilder_Result KisImageMagickConverter::buildImage(
const KURL& uri)
608 return KisImageBuilder_RESULT_NO_URI;
610 if (!TDEIO::NetAccess::exists(uri,
false, tqApp -> mainWidget())) {
611 return KisImageBuilder_RESULT_NOT_EXIST;
614 KisImageBuilder_Result result = KisImageBuilder_RESULT_FAILURE;
617 if (TDEIO::NetAccess::download(uri, tmpFile, tqApp -> mainWidget())) {
619 uriTF.setPath( tmpFile );
620 result = decode(uriTF,
false);
621 TDEIO::NetAccess::removeTempFile(tmpFile);
628 KisImageSP KisImageMagickConverter::image()
633 void KisImageMagickConverter::init(KisDoc *doc, KisUndoAdapter *adapter)
640 KisImageBuilder_Result KisImageMagickConverter::buildFile(
const KURL& uri, KisPaintLayerSP layer, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd)
647 return KisImageBuilder_RESULT_INVALID_ARG;
649 KisImageSP img = layer->image();
651 return KisImageBuilder_RESULT_EMPTY;
654 return KisImageBuilder_RESULT_NO_URI;
656 if (!uri.isLocalFile())
657 return KisImageBuilder_RESULT_NOT_LOCAL;
660 TQ_UINT32 layerBytesPerChannel = layer->paintDevice()->pixelSize() / layer->paintDevice()->nChannels();
662 GetExceptionInfo(&ei);
664 ii = CloneImageInfo(0);
666 tqstrncpy(ii -> filename, TQFile::encodeName(uri.path()), MaxTextExtent - 1);
668 if (ii -> filename[MaxTextExtent - 1]) {
669 emit notifyProgressError();
670 return KisImageBuilder_RESULT_PATH;
673 if (!img -> width() || !img -> height())
674 return KisImageBuilder_RESULT_EMPTY;
676 if (layerBytesPerChannel < 2) {
683 ii->colorspace = getColorTypeforColorSpace(layer->paintDevice()->colorSpace());
685 image = AllocateImage(ii);
686 SetImageColorspace(image, ii->colorspace);
687 image -> columns = img -> width();
688 image -> rows = img -> height();
690 kdDebug(41008) <<
"Saving with colorspace " << image->colorspace <<
", (" << layer->paintDevice()->colorSpace()->id().name() <<
")\n";
691 kdDebug(41008) <<
"IM Image thinks it has depth: " << image->depth <<
"\n";
695 image -> matte = MagickTrue;
700 image -> matte =
true;
703 TQ_INT32 y, height, width;
705 height = img -> height();
706 width = img -> width();
709 TQString ext = TQFileInfo(TQFile::encodeName(uri.path())).extension(
false).upper();
712 tqstrncpy(ii->magick,
"BMP2", MaxTextExtent - 1);
714 else if (ext ==
"RGB") {
715 tqstrncpy(ii->magick,
"SGI", MaxTextExtent - 1);
718 for (y = 0; y < height; y++) {
721 PixelPacket * pp = SetImagePixels(image, 0, y, width, 1);
724 DestroyExceptionInfo(&ei);
726 emit notifyProgressError();
727 return KisImageBuilder_RESULT_FAILURE;
731 KisHLineIterator it = layer->paintDevice()->createHLineIterator(0, y, width,
false);
733 SetImageType(image, TrueColorMatteType);
735 SetImageType(image, TrueColorType);
737 if (image->colorspace== CMYKColorspace) {
739 IndexPacket * indexes = GetIndexes(image);
741 if (layerBytesPerChannel == 2) {
742 while (!it.isDone()) {
744 const TQ_UINT16 *d =
reinterpret_cast<const TQ_UINT16 *
>(it.rawData());
745 pp -> red = ScaleShortToQuantum(d[PIXEL_CYAN]);
746 pp -> green = ScaleShortToQuantum(d[PIXEL_MAGENTA]);
747 pp -> blue = ScaleShortToQuantum(d[PIXEL_YELLOW]);
749 pp -> opacity = ScaleShortToQuantum(65535 - d[PIXEL_CMYK_ALPHA]);
750 indexes[x] = ScaleShortToQuantum(d[PIXEL_BLACK]);
757 while (!it.isDone()) {
759 TQ_UINT8 * d = it.rawData();
760 pp -> red = Upscale(d[PIXEL_CYAN]);
761 pp -> green = Upscale(d[PIXEL_MAGENTA]);
762 pp -> blue = Upscale(d[PIXEL_YELLOW]);
764 pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_CMYK_ALPHA]);
766 indexes[x]= Upscale(d[PIXEL_BLACK]);
774 else if (image->colorspace== RGBColorspace ||
775 image->colorspace == sRGBColorspace ||
776 image->colorspace == TransparentColorspace)
778 if (layerBytesPerChannel == 2) {
779 while (!it.isDone()) {
781 const TQ_UINT16 *d =
reinterpret_cast<const TQ_UINT16 *
>(it.rawData());
782 pp -> red = ScaleShortToQuantum(d[PIXEL_RED]);
783 pp -> green = ScaleShortToQuantum(d[PIXEL_GREEN]);
784 pp -> blue = ScaleShortToQuantum(d[PIXEL_BLUE]);
786 pp -> opacity = ScaleShortToQuantum(65535 - d[PIXEL_ALPHA]);
793 while (!it.isDone()) {
795 TQ_UINT8 * d = it.rawData();
796 pp -> red = Upscale(d[PIXEL_RED]);
797 pp -> green = Upscale(d[PIXEL_GREEN]);
798 pp -> blue = Upscale(d[PIXEL_BLUE]);
800 pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_ALPHA]);
807 else if (image->colorspace == GRAYColorspace)
809 SetImageType(image, GrayscaleMatteType);
810 if (layerBytesPerChannel == 2) {
811 while (!it.isDone()) {
813 const TQ_UINT16 *d =
reinterpret_cast<const TQ_UINT16 *
>(it.rawData());
814 pp -> red = ScaleShortToQuantum(d[PIXEL_GRAY]);
815 pp -> green = ScaleShortToQuantum(d[PIXEL_GRAY]);
816 pp -> blue = ScaleShortToQuantum(d[PIXEL_GRAY]);
818 pp -> opacity = ScaleShortToQuantum(65535 - d[PIXEL_GRAY_ALPHA]);
825 while (!it.isDone()) {
826 TQ_UINT8 * d = it.rawData();
827 pp -> red = Upscale(d[PIXEL_GRAY]);
828 pp -> green = Upscale(d[PIXEL_GRAY]);
829 pp -> blue = Upscale(d[PIXEL_GRAY]);
831 pp -> opacity = Upscale(OPACITY_OPAQUE - d[PIXEL_GRAY_ALPHA]);
839 kdDebug(41008) <<
"Unsupported image format\n";
840 return KisImageBuilder_RESULT_INVALID_ARG;
843 emit notifyProgressStage(i18n(
"Saving..."), y * 100 / height);
846 if (SyncImagePixels(image) == MagickFalse)
847 kdDebug(41008) <<
"Syncing pixels failed\n";
849 if (!SyncImagePixels(image))
850 kdDebug(41008) <<
"Syncing pixels failed\n";
855 exportAnnotationsForImage(image, annotationsStart, annotationsEnd);
860 WriteImage(ii, image);
861 DestroyExceptionInfo(&ei);
863 emit notifyProgressDone();
864 return KisImageBuilder_RESULT_OK;
867 void KisImageMagickConverter::ioData(TDEIO::Job *job,
const TQByteArray& data)
869 if (data.isNull() || data.isEmpty()) {
870 emit notifyProgressStage(i18n(
"Loading..."), 0);
874 if (m_data.empty()) {
879 ii = CloneImageInfo(0);
880 GetExceptionInfo(&ei);
881 image = PingBlob(ii, data.data(), data.size(), &ei);
883 if (image == 0 || ei.severity == BlobError) {
884 DestroyExceptionInfo(&ei);
885 DestroyImageInfo(ii);
887 emit notifyProgressError();
892 DestroyExceptionInfo(&ei);
893 DestroyImageInfo(ii);
894 emit notifyProgressStage(i18n(
"Loading..."), 0);
897 Q_ASSERT(data.size() + m_data.size() <= m_size);
898 memcpy(&m_data[m_data.size()], data.data(), data.count());
899 m_data.resize(m_data.size() + data.count());
900 emit notifyProgressStage(i18n(
"Loading..."), m_data.size() * 100 / m_size);
906 void KisImageMagickConverter::ioResult(TDEIO::Job *job)
911 emit notifyProgressError();
913 decode(KURL(),
true);
916 void KisImageMagickConverter::ioTotalSize(TDEIO::Job * , TDEIO::filesize_t size)
919 m_data.reserve(size);
920 emit notifyProgressStage(i18n(
"Loading..."), 0);
923 void KisImageMagickConverter::cancel()
932 TQString KisImageMagickConverter::readFilters()
937 TQString description;
938 unsigned long matches;
941#ifdef HAVE_OLD_GETMAGICKINFOLIST
942 const MagickInfo **mi;
943 mi = GetMagickInfoList(
"*", &matches);
946 GetExceptionInfo(&ei);
947 const MagickInfo **mi;
948 mi = GetMagickInfoList(
"*", &matches, &ei);
949 DestroyExceptionInfo(&ei);
952 const MagickInfo *mi;
954 GetExceptionInfo(&ei);
955 mi = GetMagickInfo(
"*", &ei);
956 DestroyExceptionInfo(&ei);
963 for (
unsigned long i = 0; i < matches; i++) {
964 const MagickInfo *info = mi[i];
968 if (info -> decoder) {
970 description = info -> description;
971 kdDebug(41008) <<
"Found import filter for: " << name <<
"\n";
973 if (!description.isEmpty() && !description.contains(
'/')) {
974 all +=
"*." + name.lower() +
" *." + name +
" ";
975 s +=
"*." + name.lower() +
" *." + name +
"|";
976 s += i18n(description.utf8());
982 for (; mi; mi =
reinterpret_cast<const MagickInfo*
>(mi -> next)) {
987 description = mi -> description;
988 kdDebug(41008) <<
"Found import filter for: " << name <<
"\n";
990 if (!description.isEmpty() && !description.contains(
'/')) {
991 all +=
"*." + name.lower() +
" *." + name +
" ";
992 s +=
"*." + name.lower() +
" *." + name +
"|";
993 s += i18n(description.utf8());
1000 all +=
"|" + i18n(
"All Images");
1006 TQString KisImageMagickConverter::writeFilters()
1011 TQString description;
1012 unsigned long matches;
1015#ifdef HAVE_OLD_GETMAGICKINFOLIST
1016 const MagickInfo **mi;
1017 mi = GetMagickInfoList(
"*", &matches);
1020 GetExceptionInfo(&ei);
1021 const MagickInfo **mi;
1022 mi = GetMagickInfoList(
"*", &matches, &ei);
1023 DestroyExceptionInfo(&ei);
1026 const MagickInfo *mi;
1028 GetExceptionInfo(&ei);
1029 mi = GetMagickInfo(
"*", &ei);
1030 DestroyExceptionInfo(&ei);
1034 kdDebug(41008) <<
"Eek, no magick info!\n";
1039 for (
unsigned long i = 0; i < matches; i++) {
1040 const MagickInfo *info = mi[i];
1041 kdDebug(41008) <<
"Found export filter for: " << info -> name <<
"\n";
1042 if (info -> stealth)
1045 if (info -> encoder) {
1046 name = info -> name;
1048 description = info -> description;
1050 if (!description.isEmpty() && !description.contains(
'/')) {
1051 all +=
"*." + name.lower() +
" *." + name +
" ";
1052 s +=
"*." + name.lower() +
" *." + name +
"|";
1053 s += i18n(description.utf8());
1059 for (; mi; mi =
reinterpret_cast<const MagickInfo*
>(mi -> next)) {
1060 kdDebug(41008) <<
"Found export filter for: " << mi -> name <<
"\n";
1064 if (mi -> encoder) {
1067 description = mi -> description;
1069 if (!description.isEmpty() && !description.contains(
'/')) {
1070 all +=
"*." + name.lower() +
" *." + name +
" ";
1071 s +=
"*." + name.lower() +
" *." + name +
"|";
1072 s += i18n(description.utf8());
1080 all +=
"|" + i18n(
"All Images");
1086#include "kis_image_magick_converter.moc"