diff --git a/plugins/impex/jp2/jp2_converter.cc b/plugins/impex/jp2/jp2_converter.cc index eb31a28b45..19274cf95a 100644 --- a/plugins/impex/jp2/jp2_converter.cc +++ b/plugins/impex/jp2/jp2_converter.cc @@ -1,99 +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 "kis_iterator_ng.h" JP2Converter::JP2Converter(KisDocument *doc) { m_doc = doc; m_stop = false; } JP2Converter::~JP2Converter() { } KisImportExportErrorCode JP2Converter::buildImage(const QString &filename) { // Determine the colorspace and channel depth // Get the appropriate KoColorSpace object from KoColorSpaceRegistry const KoColorSpace* cs = 0; // Get the dimensions int width, height = 0; // Create the image m_image = new KisImage(m_doc->createUndoStore(), width, height, cs, "built image"); // Create a layer - KisPaintLayer* layer = new KisPaintLayer(m_image.data(), m_image -> nextLayerName(), quint8_MAX); + KisPaintLayerSP layer = new KisPaintLayer(m_image, 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()); + m_image->addNode(layer); // And report the status - return ImportExportCodes::Failure; + return ImportExportCodes::OK; } KisImageWSP JP2Converter::image() { return m_image; } KisImportExportErrorCode JP2Converter::buildFile(const QString &filename, KisPaintLayerSP layer, const JP2ConvertOptions& options) { return ImportExportCodes::Failure; } void JP2Converter::cancel() { m_stop = true; } diff --git a/plugins/impex/jp2/jp2_converter.h b/plugins/impex/jp2/jp2_converter.h index c5b5ebe6f7..4d60940059 100644 --- a/plugins/impex/jp2/jp2_converter.h +++ b/plugins/impex/jp2/jp2_converter.h @@ -1,68 +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 "kis_global.h" #include "kis_annotation.h" #include class KisDocument; struct JP2ConvertOptions { int rate; int numberresolution; }; class JP2Converter : public QObject { Q_OBJECT private: enum { J2K_CFMT = 0, JP2_CFMT = 1, JPT_CFMT = 2 }; public: JP2Converter(KisDocument *doc); virtual ~JP2Converter(); public: KisImportExportErrorCode buildImage(const QString &filename); KisImportExportErrorCode buildFile(const QString &filename, KisPaintLayerSP layer, const JP2ConvertOptions& options); /** * Retrieve the constructed image */ KisImageWSP image(); private: KisImportExportErrorCode decode(const QString &filename); public Q_SLOTS: virtual void cancel(); private: - KisImageWSP m_image; + KisImageSP m_image; KisDocument *m_doc; bool m_stop; }; #endif