Commit 00e51452 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Move the kra code into a separate library

The exr filter needs access to it to save the layer properties.
parent 9cccf71e
project(kritafilters)
add_subdirectory(libkra)
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_definitions( -DCPU_32_BITS )
endif()
......
......@@ -17,7 +17,7 @@ set(kritaexrimport_SOURCES
add_library(kritaexrimport MODULE ${kritaexrimport_SOURCES})
target_link_libraries(kritaexrimport kritaui ${OPENEXR_LIBRARIES} )
target_link_libraries(kritaexrimport kritaui kritalibkra ${OPENEXR_LIBRARIES} )
install(TARGETS kritaexrimport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
......@@ -30,7 +30,7 @@ ki18n_wrap_ui(kritaexrexport_SOURCES exr_export_widget.ui )
add_library(kritaexrexport MODULE ${kritaexrexport_SOURCES})
target_link_libraries(kritaexrexport kritaui ${OPENEXR_LIBRARIES} )
target_link_libraries(kritaexrexport kritaui kritalibkra ${OPENEXR_LIBRARIES} )
install(TARGETS kritaexrexport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
......
......@@ -57,6 +57,8 @@
#include <metadata/kis_meta_data_store.h>
#include <metadata/kis_meta_data_value.h>
#include "kis_kra_savexml_visitor.h"
// Do not translate!
#define HDR_LAYER "HDR Layer"
......@@ -1236,11 +1238,9 @@ QString exrConverter::Private::fetchExtraLayersInfo(QList<ExrPaintLayerSaveInfo>
for (int i = 0; i < informationObjects.size(); i++) {
ExrPaintLayerSaveInfo &info = informationObjects[i];
// XXX: impexrefactor
// quint32 unused;
// KisSaveXmlVisitor visitor(doc, rootElement, unused, QString(), false);
// QDomElement el = visitor.savePaintLayerAttributes(info.layer.data(), doc);
QDomElement el = doc.createElement("layer");
quint32 unused;
KisSaveXmlVisitor visitor(doc, rootElement, unused, QString(), false);
QDomElement el = visitor.savePaintLayerAttributes(info.layer.data(), doc);
// cut the ending '.'
QString strippedName = info.name.left(info.name.size() - 1);
......
......@@ -23,7 +23,7 @@
#include "kis_image.h"
#include "exr_extra_tags.h"
//#include "kra/kis_kra_savexml_visitor.h"
#include "kis_kra_savexml_visitor.h"
#include "kis_paint_layer.h"
......@@ -105,9 +105,9 @@ void KisExrLayersSorter::Private::processLayers(KisNodeSP root)
nodeToOrderingMap.insert(root, fetchMapValueLazy(pathToOrderingMap, path));
// if (KisPaintLayer *paintLayer = dynamic_cast<KisPaintLayer*>(root.data())) {
// KisSaveXmlVisitor::loadPaintLayerAttributes(pathToElementMap[path], paintLayer);
// }
if (KisPaintLayer *paintLayer = dynamic_cast<KisPaintLayer*>(root.data())) {
KisSaveXmlVisitor::loadPaintLayerAttributes(pathToElementMap[path], paintLayer);
}
}
KisNodeSP child = root->firstChild();
......
add_subdirectory(tests)
set(libkritaconverter_LIB_SRCS
kra_converter.cpp
kis_colorize_dom_utils.cpp
kis_kra_load_visitor.cpp
kis_kra_loader.cpp
kis_kra_save_visitor.cpp
kis_kra_saver.cpp
kis_kra_savexml_visitor.cpp
kis_kra_utils.cpp
)
set(kritakraimport_SOURCES
kra_import.cpp
${libkritaconverter_LIB_SRCS}
)
kra_converter.cpp
)
add_library(kritakraimport MODULE ${kritakraimport_SOURCES})
target_link_libraries(kritakraimport kritaui )
target_link_libraries(kritakraimport kritaui kritalibkra)
install(TARGETS kritakraimport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
set(kritakraexport_SOURCES
kra_export.cpp
${libkritaconverter_LIB_SRCS}
)
kra_converter.cpp
)
add_library(kritakraexport MODULE ${kritakraexport_SOURCES})
target_link_libraries(kritakraexport kritaui )
target_link_libraries(kritakraexport kritaui kritalibkra)
install(TARGETS kritakraexport DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
......
add_subdirectory(tests)
set(kritalibkra_LIB_SRCS
kis_colorize_dom_utils.cpp
kis_colorize_dom_utils.h
kis_kra_loader.cpp
kis_kra_loader.h
kis_kra_load_visitor.cpp
kis_kra_load_visitor.h
kis_kra_saver.cpp
kis_kra_saver.h
kis_kra_save_visitor.cpp
kis_kra_save_visitor.h
kis_kra_savexml_visitor.cpp
kis_kra_savexml_visitor.h
kis_kra_tags.h
kis_kra_utils.cpp
kis_kra_utils.h
)
add_library(kritalibkra SHARED ${kritalibkra_LIB_SRCS})
target_link_libraries(kritalibkra kritaui)
generate_export_header(kritalibkra BASE_NAME kritalibkra)
set_target_properties(kritalibkra PROPERTIES
VERSION ${GENERIC_KRITA_LIB_VERSION} SOVERSION ${GENERIC_KRITA_LIB_SOVERSION}
)
install(TARGETS kritalibkra ${INSTALL_TARGETS_DEFAULT_ARGS} )
......@@ -20,15 +20,14 @@
#define __KIS_COLORIZE_DOM_UTILS_H
#include <KoColorSpaceRegistry.h>
#include "kritaui_export.h"
#include "kritalibkra_export.h"
namespace KisLazyFillTools {
struct KeyStroke;
}
namespace KisDomUtils {
void KRITAUI_EXPORT saveValue(QDomElement *parent, const QString &tag, const KisLazyFillTools::KeyStroke &stroke);
bool KRITAUI_EXPORT loadValue(const QDomElement &e, KisLazyFillTools::KeyStroke *stroke, const KoColorSpace *colorSpace);
void KRITALIBKRA_EXPORT saveValue(QDomElement *parent, const QString &tag, const KisLazyFillTools::KeyStroke &stroke);
bool KRITALIBKRA_EXPORT loadValue(const QDomElement &e, KisLazyFillTools::KeyStroke *stroke, const KoColorSpace *colorSpace);
}
#endif /* __KIS_COLORIZE_DOM_UTILS_H */
......@@ -27,10 +27,12 @@
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kritalibkra_export.h"
class KisFilterConfiguration;
class KoStore;
class KisKraLoadVisitor : public KisNodeVisitor
class KRITALIBKRA_EXPORT KisKraLoadVisitor : public KisNodeVisitor
{
public:
......
......@@ -30,13 +30,13 @@ class KoColorSpace;
class KisPaintingAssistant;
#include <kis_types.h>
#include <kritaui_export.h>
#include "kritalibkra_export.h"
/**
* Load old-style 1.x .kra files. Updated for 2.0, let's try to stay
* compatible. But 2.0 won't be able to save 1.x .kra files unless we
* implement an export filter.
*/
class KRITAUI_EXPORT KisKraLoader
class KRITALIBKRA_EXPORT KisKraLoader
{
public:
......
......@@ -26,12 +26,12 @@
#include "kis_types.h"
#include "kis_node_visitor.h"
#include "kis_image.h"
#include "kritalibkra_export.h"
class KisPaintDeviceWriter;
class KoStore;
class KisKraSaveVisitor : public KisNodeVisitor
class KRITALIBKRA_EXPORT KisKraSaveVisitor : public KisNodeVisitor
{
public:
KisKraSaveVisitor(KoStore *store, const QString & name, QMap<const KisNode*, QString> nodeFileNames);
......
......@@ -28,7 +28,9 @@ class KoStore;
class QString;
class QStringList;
class KisKraSaver
#include "kritalibkra_export.h"
class KRITALIBKRA_EXPORT KisKraSaver
{
public:
......
......@@ -25,9 +25,9 @@
#include "kis_node_visitor.h"
#include "kis_types.h"
#include "kritaui_export.h"
#include "kritalibkra_export.h"
class KRITAUI_EXPORT KisSaveXmlVisitor : public KisNodeVisitor
class KRITALIBKRA_EXPORT KisSaveXmlVisitor : public KisNodeVisitor
{
public:
KisSaveXmlVisitor(QDomDocument doc, const QDomElement & element, quint32 &count, const QString &url, bool root);
......
......@@ -22,7 +22,6 @@
#include <QString>
/**
* Tag definitions for our xml file format
*/
......
......@@ -6,13 +6,13 @@ macro_add_unittest_definitions()
set(kis_kra_loader_test_SRCS kis_kra_loader_test.cpp )
kde4_add_broken_unit_test(KisKraLoaderTest TESTNAME krita-ui-KisKraLoaderTest ${kis_kra_loader_test_SRCS})
target_link_libraries(KisKraLoaderTest kritaimage kritaui Qt5::Test)
target_link_libraries(KisKraLoaderTest kritaimage kritaui Qt5::Test kritalibkra)
set(kis_kra_saver_test_SRCS kis_kra_saver_test.cpp )
kde4_add_broken_unit_test(KisKraSaverTest TESTNAME krita-ui-KisKraSaverTest ${kis_kra_saver_test_SRCS})
target_link_libraries(KisKraSaverTest kritaimage kritaui Qt5::Test)
target_link_libraries(KisKraSaverTest kritaimage kritaui Qt5::Test kritalibkra)
set(kis_kra_savexml_visitor_test_SRCS kis_kra_savexml_visitor_test.cpp ../kis_kra_savexml_visitor.cpp ../kis_kra_utils.cpp)
set(kis_kra_savexml_visitor_test_SRCS kis_kra_savexml_visitor_test.cpp )
kde4_add_unit_test(KisKraSaveXmlVisitorTest TESTNAME krita-ui-KisKraSaveXmlVisitorTest ${kis_kra_savexml_visitor_test_SRCS})
target_link_libraries(KisKraSaveXmlVisitorTest kritaimage kritaui Qt5::Test)
target_link_libraries(KisKraSaveXmlVisitorTest kritaimage kritaui Qt5::Test kritalibkra)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment