19#ifndef KIS_SAVE_VISITOR_H_
20#define KIS_SAVE_VISITOR_H_
24#include "kis_layer_visitor.h"
27#include "kis_paint_layer.h"
28#include "kis_group_layer.h"
30class KisSaveVisitor :
public KisLayerVisitor {
32 KisSaveVisitor(KisImageSP img, KoStore *store, TQ_UINT32 &count) :
42 void setExternalUri(TQString &uri)
52 TQString location = m_external ? TQString() : m_uri;
53 location += m_img->name() + TQString(
"/layers/layer%1").arg(m_count);
56 if (m_store->open(location)) {
57 if (!layer->paintDevice()->write(m_store)) {
58 layer->paintDevice()->disconnect();
67 if (layer->paintDevice()->colorSpace()->getProfile()) {
68 KisAnnotationSP annotation = layer->paintDevice()->colorSpace()->getProfile()->annotation();
72 location = m_external ? TQString() : m_uri;
73 location += m_img->name() + TQString(
"/layers/layer%1").arg(m_count) +
".icc";
75 if (m_store->open(location)) {
76 m_store->write(annotation->annotation());
83 KisPaintDeviceSP mask = layer->
getMask();
87 location = m_external ? TQString() : m_uri;
88 location += m_img->name() + TQString(
"/layers/layer%1").arg(m_count) +
".mask";
90 if (m_store->open(location)) {
91 if (!mask->write(m_store)) {
108 KisSaveVisitor visitor(m_img, m_store, m_count);
111 visitor.setExternalUri(m_uri);
117 child->accept(visitor);
118 child = child->nextSibling();
131 if (layer->selection()) {
132 TQString location = m_external ? TQString() : m_uri;
133 location += m_img->name() + TQString(
"/layers/layer%1").arg(m_count) +
".selection";
136 if (m_store->open(location)) {
137 if (!layer->selection()->write(m_store)) {
138 layer->selection()->disconnect();
147 if (layer->filter()) {
148 TQString location = m_external ? TQString() : m_uri;
149 location = m_external ? TQString() : m_uri;
150 location += m_img->name() + TQString(
"/layers/layer%1").arg(m_count) +
".filterconfig";
152 if (m_store->open(location)) {
153 TQString s = layer->filter()->
toString();
154 m_store->write(s.utf8(), tqstrlen(s.utf8()));
Class that contains a KisFilter and optionally a KisSelection.
virtual TQString toString()
Create a serialized version of this filter config.
A KisLayer that bundles child layers into a single layer.
virtual KisLayerSP firstChild() const
Returns the first child layer of this layer (if it supports that).
This layer is of a type that can be painted on.
KisPaintDeviceSP getMask()
Returns the layer mask's device. Creates one if there is currently none.
bool hasMask() const
Does this layer have a layer mask?
An interface for the Part Layer so that we can use it in core/, but can implement it in ui/.