diff --git a/plugins/impex/CMakeLists.txt b/plugins/impex/CMakeLists.txt index d69840f873..80961161b5 100644 --- a/plugins/impex/CMakeLists.txt +++ b/plugins/impex/CMakeLists.txt @@ -1,56 +1,56 @@ project(kritafilters) add_subdirectory(libkra) if(CMAKE_SIZEOF_VOID_P EQUAL 4) add_definitions( -DCPU_32_BITS ) endif() if(JPEG_FOUND AND HAVE_LCMS2) add_subdirectory(jpeg) endif() if(TIFF_FOUND) add_subdirectory(tiff) endif() if(PNG_FOUND) add_subdirectory(png) add_subdirectory(csv) endif() if(OPENEXR_FOUND) add_subdirectory(exr) endif() if(Poppler_Qt5_FOUND) add_subdirectory(pdf) endif() -if(OPENJPEG_FOUND) +if(OpenJPEG_FOUND) add_subdirectory(jp2) endif() if(LIBRAW_FOUND) add_subdirectory(raw) endif() add_subdirectory(svg) add_subdirectory(qimageio) add_subdirectory(ora) add_subdirectory(xcf) add_subdirectory(psd) add_subdirectory(qml) add_subdirectory(tga) add_subdirectory(heightmap) add_subdirectory(brush) add_subdirectory(spriter) add_subdirectory(kra) if (GIF_FOUND) add_subdirectory(gif) endif() if (HEIF_FOUND) add_subdirectory(heif) endif() diff --git a/plugins/impex/jp2/CMakeLists.txt b/plugins/impex/jp2/CMakeLists.txt index 0b885a99a7..b6b5f0398f 100644 --- a/plugins/impex/jp2/CMakeLists.txt +++ b/plugins/impex/jp2/CMakeLists.txt @@ -1,30 +1,29 @@ -include_directories(SYSTEM ${OPENJPEG_INCLUDE_DIR}) +include_directories(SYSTEM ${OpenJPEG_INCLUDE_DIR}) set(libkritaconverter_LIB_SRCS jp2_converter.cc ) set(kritajp2import_SOURCES jp2_import.cc ${libkritaconverter_LIB_SRCS} - ) - -add_library(kritajp2import MODULE ${kritajp2import_SOURCES}) - -target_link_libraries(kritajp2import kritaui ${OPENJPEG_LIBRARIES} ) - -install(TARGETS kritajp2import DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) - -set(kritajp2export_SOURCES - jp2_export.cc - ${libkritaconverter_LIB_SRCS} ) -ki18n_wrap_ui(kritajp2export_SOURCES kis_wdg_options_jp2.ui ) - -add_library(kritajp2export MODULE ${kritajp2export_SOURCES}) - -target_link_libraries(kritajp2export kritaui ${OPENJPEG_LIBRARIES} ) +add_library(kritajp2import MODULE ${kritajp2import_SOURCES}) -install(TARGETS kritajp2export DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) +target_link_libraries(kritajp2import kritaui ${OpenJPEG_LIBRARIES} ) + +install(TARGETS kritajp2import DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) + +#set(kritajp2export_SOURCES +# jp2_export.cc +# ${libkritaconverter_LIB_SRCS} +#) +# +#ki18n_wrap_ui(kritajp2export_SOURCES kis_wdg_options_jp2.ui ) +# +#add_library(kritajp2export MODULE ${kritajp2export_SOURCES}) +# +#target_link_libraries(kritajp2export kritaui ${OPENJPEG_LIBRARIES} ) +#install(TARGETS kritajp2export DESTINATION ${KRITA_PLUGIN_INSTALL_DIR}) install( PROGRAMS krita_jp2.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) diff --git a/plugins/impex/jp2/jp2_converter.cc b/plugins/impex/jp2/jp2_converter.cc index 11cc175634..eb31a28b45 100644 --- a/plugins/impex/jp2/jp2_converter.cc +++ b/plugins/impex/jp2/jp2_converter.cc @@ -1,468 +1,99 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1 of the License. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "jp2_converter.h" -#include - #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kis_iterator_ng.h" -jp2Converter::jp2Converter(KisDocument *doc) +JP2Converter::JP2Converter(KisDocument *doc) { m_doc = doc; m_stop = false; } -jp2Converter::~jp2Converter() -{ -} - -/** - * sample error callback expecting a FILE* client object - * */ -void -error_callback(const char *msg, void *client_data) -{ - FILE *stream = (FILE *) client_data; - fprintf(stream, "[ERROR] %s", msg); -} - -/** - * sample warning callback expecting a FILE* client object - * */ -void -warning_callback(const char *msg, void *client_data) +JP2Converter::~JP2Converter() { - FILE *stream = (FILE *) client_data; - fprintf(stream, "[WARNING] %s", msg); } -/** - * sample debug callback expecting no client object - * */ -void -info_callback(const char *msg, void *client_data) -{ - Q_UNUSED(client_data); - fprintf(stdout, "[INFO] %s", msg); -} -KisImageBuilder_Result jp2Converter::decode(const QString &filename) +KisImportExportErrorCode JP2Converter::buildImage(const QString &filename) { - // decompression parameters - opj_dparameters_t parameters; - opj_set_default_decoder_parameters(¶meters); - // Determine the type - parameters.decod_format = getFileFormat(filename); // TODO isn't there some magic code ? - if (parameters.decod_format == -1) { - return KisImageBuilder_RESULT_UNSUPPORTED; - } - // open the file - QFile fp(filename); - fp.open(QIODevice::ReadOnly); - QByteArray src = fp.readAll(); - fp.close(); - // Decode the file - opj_dinfo_t *dinfo = 0; - - bool hasColorSpaceInfo = false; - /* get a decoder handle */ - switch (parameters.decod_format) { - case J2K_CFMT: { - dinfo = opj_create_decompress(CODEC_J2K); - break; - } - case JP2_CFMT: { - dinfo = opj_create_decompress(CODEC_JP2); - hasColorSpaceInfo = true; - break; - } - case JPT_CFMT: { - dinfo = opj_create_decompress(CODEC_JPT); - break; - } - } - Q_ASSERT(dinfo); - - /* setup the decoder decoding parameters using user parameters */ - opj_setup_decoder(dinfo, ¶meters); - - /* open a byte stream */ - opj_cio_t *cio = opj_cio_open((opj_common_ptr) dinfo, (unsigned char*)src.data(), src.length()); + // Determine the colorspace and channel depth - // Setup an event manager - opj_event_mgr_t event_mgr; /* event manager */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; + // Get the appropriate KoColorSpace object from KoColorSpaceRegistry + const KoColorSpace* cs = 0; - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr) dinfo, &event_mgr, stderr); - - /* decode the stream and fill the image structure */ - opj_image_t *image = opj_decode(dinfo, cio); - - /* close the byte stream */ - opj_cio_close(cio); - if (!image) { - opj_destroy_decompress(dinfo); - 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].bpp != bitdepth) { - opj_destroy_decompress(dinfo); - return KisImageBuilder_RESULT_FAILURE; - } - } - dbgFile << "Image has " << components << " components and a bit depth of " << bitdepth << " for color space " << image->color_space; - if (bitdepth == 0) { - bitdepth = 8; - } - const KoColorSpace* colorSpace = 0; - QVector channelorder(components); - if (!hasColorSpaceInfo) { - if (components == 3) { - image->color_space = CLRSPC_SRGB; - } else if (components == 1) { - image->color_space = CLRSPC_GRAY; - } - } - switch (image->color_space) { - case CLRSPC_UNKNOWN: - break; - case CLRSPC_SRGB: { - if (bitdepth == 16) { - colorSpace = KoColorSpaceRegistry::instance()->rgb16(); - } else if (bitdepth == 8) { - colorSpace = KoColorSpaceRegistry::instance()->rgb8(); - } - if (components != 3) { - opj_destroy_decompress(dinfo); - return KisImageBuilder_RESULT_FAILURE; - } - channelorder[0] = KoBgrU16Traits::red_pos; - channelorder[1] = KoBgrU16Traits::green_pos; - channelorder[2] = KoBgrU16Traits::blue_pos; - break; - } - case CLRSPC_GRAY: { - if (bitdepth == 16) { - colorSpace = KoColorSpaceRegistry::instance()->colorSpace( GrayAColorModelID.id(), Integer16BitsColorDepthID.id(), ""); - } else if (bitdepth == 8) { - colorSpace = KoColorSpaceRegistry::instance()->colorSpace(GrayAColorModelID.id(), Integer8BitsColorDepthID.id(), ""); - } - if (components != 1) { - opj_destroy_decompress(dinfo); - return KisImageBuilder_RESULT_FAILURE; - } - channelorder[0] = 0; - break; - } - case CLRSPC_SYCC: { - if (bitdepth == 16) { - colorSpace = KoColorSpaceRegistry::instance()->colorSpace( "YUV", Integer16BitsColorDepthID.id(), ""); - } else if (bitdepth == 8) { - colorSpace = KoColorSpaceRegistry::instance()->colorSpace("YUV", Integer8BitsColorDepthID.id(), ""); - } - if (components != 3) { - opj_destroy_decompress(dinfo); - return KisImageBuilder_RESULT_FAILURE; - } - channelorder[0] = 0; - channelorder[1] = 1; - channelorder[2] = 2; - break; - } - default: - ; - } - if (!colorSpace) { - dbgFile << "No colors space found for that image"; - return KisImageBuilder_RESULT_FAILURE; - } + // Get the dimensions + int width, height = 0; // Create the image - if (m_image == 0) { - m_image = new KisImage(m_doc->createUndoStore(), image->x1, image->y1, colorSpace, "built image"); - } - - // Create the layer - KisPaintLayerSP layer = new KisPaintLayer(m_image.data(), m_image->nextLayerName(), OPACITY_OPAQUE_U8); - m_image->addNode(layer.data(), m_image->rootLayer().data()); - - // Set the data - int pos = 0; - KisHLineIteratorSP it = layer->paintDevice()->createHLineIteratorNG(0, 0, image->x1); - for (int v = 0; v < image->y1; ++v) { - if (bitdepth == 16) { - do { - quint16* px = reinterpret_cast(it->rawData()); - for (int i = 0; i < components; ++i) { - px[channelorder[i]] = image->comps[i].data[pos]; - } - colorSpace->setOpacity(it->rawData(), OPACITY_OPAQUE_U8, 1); - ++pos; - - } while (it->nextPixel()); - } else if (bitdepth == 8) { - do { - quint8* px = reinterpret_cast(it->rawData()); - for (int i = 0; i < components; ++i) { - px[channelorder[i]] = image->comps[i].data[pos]; - } - colorSpace->setOpacity(px, OPACITY_OPAQUE_U8, 1); - ++pos; + m_image = new KisImage(m_doc->createUndoStore(), width, height, cs, "built image"); - } while (it->nextPixel()); - } - it->nextRow(); - } - - return KisImageBuilder_RESULT_OK; -} + // Create a layer + KisPaintLayer* layer = new KisPaintLayer(m_image.data(), m_image -> nextLayerName(), quint8_MAX); + // Fill the layer with pixels + // ... + // Set the layer on the image + m_image->addNode(KisNodeSP(layer), m_image->rootLayer().data()); -KisImageBuilder_Result jp2Converter::buildImage(const QString &filename) -{ - return decode(filename); + // And report the status + return ImportExportCodes::Failure; } -KisImageWSP jp2Converter::getImage() +KisImageWSP JP2Converter::image() { return m_image; } -KisImageBuilder_Result jp2Converter::buildFile(const QString &filename, KisPaintLayerSP layer, const JP2ConvertOptions& options) +KisImportExportErrorCode JP2Converter::buildFile(const QString &filename, KisPaintLayerSP layer, const JP2ConvertOptions& options) { - if (!layer) - return KisImageBuilder_RESULT_INVALID_ARG; - - KisImageWSP kisimage = layer->image(); - if (!kisimage) - return KisImageBuilder_RESULT_EMPTY; - - // Init parameters - opj_cparameters_t parameters; - opj_set_default_encoder_parameters(¶meters); - parameters.cp_comment = (char*)"Created by Krita"; - parameters.subsampling_dx = 1; - parameters.subsampling_dy = 1; - parameters.cp_disto_alloc = 1; - parameters.tcp_numlayers = 1; - parameters.numresolution = options.numberresolution; - dbgFile << 100 - options.rate; - parameters.tcp_rates[0] = options.rate; - - - // Set the colorspace information - OPJ_COLOR_SPACE clrspc; - int components; - QVector channelorder; - if (layer->colorSpace()->colorModelId() == GrayAColorModelID || layer->colorSpace()->colorModelId() == GrayColorModelID) { - clrspc = CLRSPC_GRAY; - components = 1; - channelorder.resize(components); - channelorder[0] = 0; - } else if (layer->colorSpace()->colorModelId() == RGBAColorModelID) { - clrspc = CLRSPC_SRGB; - components = 3; - channelorder.resize(components); - channelorder[0] = KoBgrU16Traits::red_pos; - channelorder[1] = KoBgrU16Traits::green_pos; - channelorder[2] = KoBgrU16Traits::blue_pos; - } else { - QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Cannot export images in %1.\n", layer->colorSpace()->name())) ; - return KisImageBuilder_RESULT_FAILURE; - } - - int bitdepth; - if (layer->colorSpace()->colorDepthId() == Integer8BitsColorDepthID) { - bitdepth = 8; -// TODO OpenJpeg does not really support 16bits yet -// } else if (layer->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) { -// bitdepth = 16; - } else { - QMessageBox::critical(0, i18nc("@title:window", "Krita"), i18n("Cannot export images in %1.\n", layer->colorSpace()->name())) ; - return KisImageBuilder_RESULT_FAILURE; - } - - // Init the image - opj_image_cmptparm_t image_info[3]; - - int width = kisimage->width(); - int height = kisimage->height(); - for (int k = 0; k < components; k++) { - image_info[k].dx = 1; - image_info[k].dy = 1; - image_info[k].w = width; - image_info[k].h = height; - image_info[k].x0 = 0; - image_info[k].y0 = 0; - image_info[k].prec = 8; - image_info[k].bpp = bitdepth; - image_info[k].sgnd = 0; - } - opj_image_t *image = opj_image_create(components, image_info, clrspc); - image->x1 = width; - image->y1 = height; - image->x0 = 0; - image->y0 = 0; - - // Copy the data in the image - int pos = 0; - KisHLineIteratorSP it = layer->paintDevice()->createHLineIteratorNG(0, 0, image->x1); - for (int v = 0; v < height; ++v) { - if (bitdepth == 16) { - do { - quint16* px = reinterpret_cast(it->rawData()); - for (int i = 0; i < components; ++i) { - image->comps[i].data[pos] = px[channelorder[i]]; - } - ++pos; - - } while (it->nextPixel()); - } else if (bitdepth == 8) { - do { - quint8* px = reinterpret_cast(it->rawData()); - for (int i = 0; i < components; ++i) { - image->comps[i].data[pos] = px[channelorder[i]]; - } - ++pos; - - } while (it->nextPixel()); - } - it->nextRow(); - } - - // coding format - parameters.decod_format = getFileFormat(filename); // TODO isn't there some magic code ? - - // Decode the file - opj_cinfo_t *cinfo = 0; - - /* get a decoder handle */ - switch (parameters.decod_format) { - case J2K_CFMT: { - cinfo = opj_create_compress(CODEC_J2K); - break; - } - case JP2_CFMT: { - cinfo = opj_create_compress(CODEC_JP2); - break; - } - case JPT_CFMT: { - cinfo = opj_create_compress(CODEC_JPT); - break; - } - } - - if (!cinfo) { - // Could not create compression info object - return KisImageBuilder_RESULT_FAILURE; - } - - // Setup an event manager - opj_event_mgr_t event_mgr; /* event manager */ - memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); - event_mgr.error_handler = error_callback; - event_mgr.warning_handler = warning_callback; - event_mgr.info_handler = info_callback; - - /* catch events using our callbacks and give a local context */ - opj_set_event_mgr((opj_common_ptr) cinfo, &event_mgr, stderr); - - - /* setup the encoder parameters using the current image and using user parameters */ - opj_setup_encoder(cinfo, ¶meters, image); - - opj_cio_t* cio = opj_cio_open((opj_common_ptr) cinfo, 0, 0); - - - /* encode the image */ - if (!opj_encode(cinfo, cio, image, parameters.index)) { - opj_cio_close(cio); - opj_destroy_compress(cinfo); - return KisImageBuilder_RESULT_FAILURE; - } - - // Write to the file - QFile fp(filename); - fp.open(QIODevice::WriteOnly); - int length = cio_tell(cio); - dbgFile << "Length of the file to save: " << length; - fp.write((char*)cio->buffer, length); - fp.close(); - - opj_cio_close(cio); - opj_destroy_compress(cinfo); - - return KisImageBuilder_RESULT_OK; + return ImportExportCodes::Failure; } -void jp2Converter::cancel() +void JP2Converter::cancel() { m_stop = true; } -int jp2Converter::getFileFormat(const QString &filename) const -{ - QString extension = QFileInfo(filename).suffix().toLower(); - if (extension == "j2k" || extension == "j2c") { - return J2K_CFMT; - } else if (extension == "jp2") { - return JP2_CFMT; - } else if (extension == "jpt") { - return JPT_CFMT; - } - return -1; -} diff --git a/plugins/impex/jp2/jp2_converter.h b/plugins/impex/jp2/jp2_converter.h index cb24aa7b24..c5b5ebe6f7 100644 --- a/plugins/impex/jp2/jp2_converter.h +++ b/plugins/impex/jp2/jp2_converter.h @@ -1,66 +1,68 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1 of the License. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _JP2_CONVERTER_H_ #define _JP2_CONVERTER_H_ #include #include +#include #include "kis_types.h" -#include +#include "kis_global.h" +#include "kis_annotation.h" +#include + class KisDocument; struct JP2ConvertOptions { int rate; int numberresolution; }; -class jp2Converter : public QObject +class JP2Converter : public QObject { Q_OBJECT private: enum { J2K_CFMT = 0, JP2_CFMT = 1, JPT_CFMT = 2 }; public: - jp2Converter(KisDocument *doc); - virtual ~jp2Converter(); + JP2Converter(KisDocument *doc); + virtual ~JP2Converter(); public: - KisImageBuilder_Result buildImage(const QString &filename); - KisImageBuilder_Result buildFile(const QString &filename, KisPaintLayerSP layer, const JP2ConvertOptions& options); + KisImportExportErrorCode buildImage(const QString &filename); + KisImportExportErrorCode buildFile(const QString &filename, KisPaintLayerSP layer, const JP2ConvertOptions& options); /** * Retrieve the constructed image */ - KisImageWSP getImage(); + KisImageWSP image(); private: - KisImageBuilder_Result decode(const QString &filename); + KisImportExportErrorCode decode(const QString &filename); public Q_SLOTS: virtual void cancel(); -private: - int getFileFormat(const QString &filename) const; private: KisImageWSP m_image; KisDocument *m_doc; bool m_stop; }; #endif diff --git a/plugins/impex/jp2/jp2_import.cc b/plugins/impex/jp2/jp2_import.cc index 2cf66afa54..c7178521aa 100644 --- a/plugins/impex/jp2/jp2_import.cc +++ b/plugins/impex/jp2/jp2_import.cc @@ -1,91 +1,50 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1 of the License. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "jp2_import.h" #include #include -#include - #include #include #include "jp2_converter.h" K_PLUGIN_FACTORY_WITH_JSON(ImportFactory, "krita_jp2_import.json", registerPlugin();) jp2Import::jp2Import(QObject *parent, const QVariantList &) : KisImportExportFilter(parent) { } jp2Import::~jp2Import() { } -KisImportExportFilter::ConversionStatus jp2Import::convert(const QByteArray&, const QByteArray& to) +KisImportExportErrorCode jp2Import::convert(KisDocument *document, QIODevice */*io*/, KisPropertiesConfigurationSP /*configuration*/) { - dbgFile << "Importing using JP2Import!"; - - if (to != "application/x-krita") - return KisImportExportFilter::BadMimeType; - - KisDocument * doc = outputDocument(); - - if (!doc) - return KisImportExportFilter::NoDocumentCreated; - - QString filename = inputFile(); - - doc->prepareForImport(); - - if (!filename.isEmpty()) { - - jp2Converter ib(doc); - - switch (ib.buildImage(filename)) { - case KisImageBuilder_RESULT_UNSUPPORTED: - return KisImportExportFilter::NotImplemented; - break; - case KisImageBuilder_RESULT_INVALID_ARG: - return KisImportExportFilter::BadMimeType; - break; - case KisImageBuilder_RESULT_NO_URI: - case KisImageBuilder_RESULT_NOT_LOCAL: - return KisImportExportFilter::FileNotFound; - break; - case KisImageBuilder_RESULT_BAD_FETCH: - case KisImageBuilder_RESULT_EMPTY: - return KisImportExportFilter::ParsingError; - break; - case KisImageBuilder_RESULT_FAILURE: - return KisImportExportFilter::InternalError; - break; - case KisImageBuilder_RESULT_OK: - doc -> setCurrentImage(ib.getImage()); - return KisImportExportFilter::OK; - default: - break; - } - + JP2Converter converter(document); + KisImportExportErrorCode result = converter.buildImage(filename()); + if (result.isOk()) { + document->setCurrentImage(converter.image()); } - return KisImportExportFilter::StorageCreationError; + return result; } #include diff --git a/plugins/impex/jp2/jp2_import.h b/plugins/impex/jp2/jp2_import.h index fd51b67f40..3cbfaf6ad5 100644 --- a/plugins/impex/jp2/jp2_import.h +++ b/plugins/impex/jp2/jp2_import.h @@ -1,36 +1,36 @@ /* * Copyright (c) 2009 Cyrille Berger * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 2.1 of the License. * * This library 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef JP2_IMPORT_H_ #define JP2_IMPORT_H_ #include #include class jp2Import : public KisImportExportFilter { Q_OBJECT public: jp2Import(QObject *parent, const QVariantList &); virtual ~jp2Import(); public: - virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to); + KisImportExportErrorCode convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration = 0) override; }; #endif diff --git a/plugins/impex/jp2/krita_jp2.desktop b/plugins/impex/jp2/krita_jp2.desktop index e7ca394f71..2d25482673 100644 --- a/plugins/impex/jp2/krita_jp2.desktop +++ b/plugins/impex/jp2/krita_jp2.desktop @@ -1,120 +1,117 @@ [Desktop Entry] Categories=Qt;KDE;Office;Graphics; -Exec=krita %u GenericName=Application for Drawing and Handling of Images GenericName[bg]=Приложение за рисуване и обработка на изображения GenericName[bs]=Aplikacija za crtanje i upravljanje slikom GenericName[ca]=Aplicació per a dibuix i modificació d'imatges GenericName[ca@valencia]=Aplicació per a dibuix i modificació d'imatges GenericName[da]=Tegne- og billedbehandlingsprogram GenericName[de]=Programm zum Zeichnen und Bearbeiten von Bildern GenericName[el]=Εφαρμογή για επεξεργασία και χειρισμό εικόνων GenericName[en_GB]=Application for Drawing and Handling of Images GenericName[eo]=Aplikaĵo por Desegnado kaj Mastrumado de Bildoj GenericName[es]=Aplicación para dibujo y manipulación de imágenes GenericName[et]=Joonistamise ja pilditöötluse rakendus GenericName[eu]=Irudiak marrazteko eta manipulatzeko aplikazioa GenericName[fa]=کاربرد برای ترسیم و به کار بردن تصاویر GenericName[fi]=Ohjelma kuvien piirtämiseen ja käsittelyyn GenericName[fr]=Application pour dessiner et manipuler des images GenericName[fy]=Aplikaasje om ôfbyldings mei te tekenjen en te bewurkjen GenericName[ga]=Feidhmchlár le haghaidh Líníochta agus Láimhseála Íomhánna GenericName[gl]=Aplicativo de debuxo e edición de imaxes GenericName[he]=יישום לצביעה וניהול תמונות GenericName[hi]=छवियों को ड्रा करने तथा उन्हें प्रबन्धित करने का अनुप्रयोग GenericName[hne]=फोटू मन ल ड्रा करे अउ ओ मन ल प्रबन्धित करे के अनुपरयोग GenericName[hu]=Rajzoló és képkezelő GenericName[is]=Teikni og myndvinnsluforrit GenericName[it]=Applicazione di disegno e gestione di immagini GenericName[kk]=Кескінді салу және өңдеу бағдарламасы GenericName[ko]=그림 그리기 및 처리 프로그램 GenericName[lv]=Programma zīmēšanai un attēlu apstrādei GenericName[nb]=Program for tegning og bildehåndtering GenericName[nds]=Programm för't Teken un Bildhanteren GenericName[ne]=रेखाचित्र बनाउन र छविको ह्यान्डल गर्नका लागि अनुप्रयोग GenericName[nl]=Toepassing om afbeeldingen te tekenen en te bewerken GenericName[pl]=Program do rysowania i obróbki obrazów GenericName[pt]=Aplicação de Desenho e Manipulação de Imagens GenericName[pt_BR]=Aplicativo de desenho e manipulação de imagens GenericName[ru]=Растровые изображения GenericName[sk]=Aplikácia na kresnenie a manilupáciu s obrázkami GenericName[sl]=Program za risanje in rokovanje s slikami GenericName[sv]=Program för att rita och hantera bilder GenericName[ta]=பிம்பங்களை கையாளுதல் மற்றும் வரைதலுக்கான பயன்னாடு GenericName[tr]=Çizim ve Resim İşleme Uygulaması GenericName[uk]=Програма для малювання і обробки зображень GenericName[uz]=Rasm chizish dasturi GenericName[uz@cyrillic]=Расм чизиш дастури GenericName[wa]=Programe po dessiner et apougnî des imådjes GenericName[x-test]=xxApplication for Drawing and Handling of Imagesxx GenericName[zh_CN]=绘制和操纵图像的应用程序 GenericName[zh_TW]=影像繪製與處理應用程式 -Icon=calligrakrita -MimeType=image/jp2; Name=Krita Name[af]=Krita Name[bg]=Krita Name[br]=Krita Name[bs]=Krita Name[ca]=Krita Name[ca@valencia]=Krita Name[cs]=Krita Name[cy]=Krita Name[da]=Krita Name[de]=Krita Name[el]=Krita Name[en_GB]=Krita Name[eo]=Krita Name[es]=Krita Name[et]=Krita Name[eu]=Krita Name[fi]=Krita Name[fr]=Krita Name[fy]=Krita Name[ga]=Krita Name[gl]=Krita Name[he]=Krita Name[hi]=केरिता Name[hne]=केरिता Name[hr]=Krita Name[hu]=Krita Name[ia]=Krita Name[is]=Krita Name[it]=Krita Name[kk]=Krita Name[ko]=Krita Name[lt]=Krita Name[lv]=Krita Name[mr]=क्रिटा Name[ms]=Krita Name[nb]=Krita Name[nds]=Krita Name[ne]=क्रिता Name[nl]=Krita Name[pl]=Krita Name[pt]=Krita Name[pt_BR]=Krita Name[ro]=Krita Name[ru]=Krita Name[se]=Krita Name[sk]=Krita Name[sl]=Krita Name[sv]=Krita Name[ta]=கிரிட்டா Name[tg]=Krita Name[tr]=Krita Name[ug]=Krita Name[uk]=Krita Name[uz]=Krita Name[uz@cyrillic]=Krita Name[wa]=Krita Name[xh]=Krita Name[x-test]=xxKritaxx Name[zh_CN]=Krita Name[zh_TW]=繪圖_Krita -StartupNotify=true -Terminal=false +Exec=krita %u +MimeType=image/jp2; Type=Application -X-KDE-SubstituteUID=false -X-KDE-Username= +Icon=krita +StartupNotify=true NoDisplay=true diff --git a/plugins/impex/jp2/krita_jp2_export.json b/plugins/impex/jp2/krita_jp2_export.json index 5b91b4d7b0..31c18a1af3 100644 --- a/plugins/impex/jp2/krita_jp2_export.json +++ b/plugins/impex/jp2/krita_jp2_export.json @@ -1,13 +1,12 @@ { - "Icon": "", - "Id": "Krita jp2 Export Filter", + "Id": "Krita jpeg2000 Export Filter", + "NoDisplay": "true", "Type": "Service", "X-KDE-Export": "image/jp2", - "X-KDE-Import": "application/x-krita", "X-KDE-Library": "kritajp2export", "X-KDE-ServiceTypes": [ "Krita/FileFilter" ], "X-KDE-Weight": "1", "X-KDE-Extensions" : "jp2" } diff --git a/plugins/impex/jp2/krita_jp2_import.json b/plugins/impex/jp2/krita_jp2_import.json index ade36b72cd..f1aa8980f6 100644 --- a/plugins/impex/jp2/krita_jp2_import.json +++ b/plugins/impex/jp2/krita_jp2_import.json @@ -1,13 +1,12 @@ { - "Icon": "", - "Id": "Krita jp2 Import Filter", + "Id": "Krita jpeg2000 Import Filter", + "NoDisplay": "true", "Type": "Service", - "X-KDE-Export": "application/x-krita", "X-KDE-Import": "image/jp2", "X-KDE-Library": "kritajp2import", "X-KDE-ServiceTypes": [ "Krita/FileFilter" ], "X-KDE-Weight": "1", "X-KDE-Extensions" : "jp2" }