koffice/krita/plugins/formats

Cyrille Berger cyb at lepi.org
Fri Nov 13 10:25:19 CET 2009


SVN commit 1048335 by berger:

Remove the gmagick filter

The last remain of our dependency on the magick family is now gone from krita. RIP

CCMAIL:kimageshop at kde.org


 M  +0 -6      CMakeLists.txt  
 D             gmagick (directory)  
 M  +48 -0     jp2/jp2_converter.cc  


--- trunk/koffice/krita/plugins/formats/CMakeLists.txt #1048334:1048335
@@ -31,8 +31,6 @@
     set(BUILD_GRAPHICSMAGICK TRUE)
 endif(GRAPHICSMAGICK_FOUND AND GRAPHICSMAGICK_VERSION VERSION_LESS ${BAD_GRAPHICS_MAGICK_VERSION})
 
-macro_log_feature(HAVE_REQUIRED_GM_VERSION "GraphicsMagick" "GraphicsMagick Image Processing System" "http://www.graphicsmagick.org" FALSE "1.1" "Required by the Krita GraphicsMagick filter for various file formats (including PSD, XCF). Version 1.2 is broken!")
-
 include_directories(${KRITA_INCLUDES})
 
 if(KDCRAW_FOUND)
@@ -56,10 +54,6 @@
     add_subdirectory(openexr)
 endif(OPENEXR_FOUND AND OPENCTL_FOUND)
 
-if(BUILD_GRAPHICSMAGICK)
-    add_subdirectory(gmagick)
-endif(BUILD_GRAPHICSMAGICK)
-
 if(POPPLER_FOUND AND HAVE_POPPLER_0_6)
     add_subdirectory(pdf)
 endif(POPPLER_FOUND AND HAVE_POPPLER_0_6)
--- trunk/koffice/krita/plugins/formats/jp2/jp2_converter.cc #1048334:1048335
@@ -30,6 +30,7 @@
 #include <kis_paint_layer.h>
 #include <kis_undo_adapter.h>
 #include <QFileInfo>
+#include <KoColorSpaceRegistry.h>
 
 jp2Converter::jp2Converter(KisDoc2 *doc, KisUndoAdapter *adapter)
 {
@@ -88,6 +89,53 @@
         return KisImageBuilder_RESULT_FAILURE;
     }
 
+    // Look for the colorspace
+    int components = image->numcomps;
+    if (image->numcomps == 0) {
+        opj_destroy_decompress(dinfo);
+        return KisImageBuilder_RESULT_FAILURE;
+    }
+    int bitdepth = image->comps[0].bpp;
+    for (int i = 1; i < components; ++i) {
+        if (image->comps[i] != bitdepth) {
+            opj_destroy_decompress(dinfo);
+            return KisImageBuilder_RESULT_FAILURE;
+        }
+    }
+
+    const KoColorSpace* colorSpace = 0;
+    switch (image->color_space) {
+    case CLRSPC_UNKNOWN:
+        break;
+    case CLRSPC_SRGB: {
+        if (bitdepth == 16) {
+            colorSpace = KoColorSpaceRegistry::instance()->colorSpace("RGBA16");
+        } else if (bitdepth == 8) {
+            colorSpace = KoColorSpaceRegistry::instance()->colorSpace("RGBA");
+        }
+        break;
+    }
+    case CLRSPC_GRAY: {
+        if (bitdepth == 16) {
+            colorSpace = KoColorSpaceRegistry::instance()->colorSpace("GRAYA16");
+        } else if (bitdepth == 8) {
+            colorSpace = KoColorSpaceRegistry::instance()->colorSpace("GRAYA");
+        }
+        break;
+    }
+    case CLRSPC_SYCC: {
+        if (bitdepth == 16) {
+            colorSpace = KoColorSpaceRegistry::instance()->colorSpace("YUVA16");
+        } else if (bitdepth == 8) {
+            colorSpace = KoColorSpaceRegistry::instance()->colorSpace("YUVA8");
+        }
+        break;
+    }
+    }
+    if (!colorSpace) {
+        return KisImageBuilder_RESULT_FAILURE;
+    }
+
     return KisImageBuilder_RESULT_OK;
 }
 


More information about the kimageshop mailing list