Commit d620be16 authored by InkLab's avatar InkLab 🎨 Committed by Boudewijn Rempt

ORA export, write entire layers instead of cropping them

This change stores the full image layer data in exported ORA files, even when part of the layer is outside of the visible canvas.
(similar to how layer data is stored in KRA format) Properly adds the "x" and "y" attribute to the resulting layer stack to re assemble
 the image. This change address a previous issue where the layer data would become cropped when exporting to ORA format, resulting in
lost layer data in some cases.
parent 94dc6c1a
......@@ -60,6 +60,8 @@ void KisOpenRasterStackSaveVisitor::saveLayerInfo(QDomElement& elt, KisLayer* la
elt.setAttribute("name", layer->name());
elt.setAttribute("opacity", QString().setNum(layer->opacity() / 255.0));
elt.setAttribute("visibility", layer->visible() ? "visible" : "hidden");
elt.setAttribute("x", QString().setNum(layer->x()));
elt.setAttribute("y", QString().setNum(layer->y()));
if (layer->userLocked()) {
elt.setAttribute("edit-locked", "true");
......@@ -161,7 +163,11 @@ bool KisOpenRasterStackSaveVisitor::visit(KisExternalLayer * layer)
bool KisOpenRasterStackSaveVisitor::saveLayer(KisLayer *layer)
QString filename = d->saveContext->saveDeviceData(layer->projection(), layer->metaData(), layer->image()->bounds(), layer->image()->xRes(), layer->image()->yRes());
// here we adjust the bounds to encompass the entire area of the layer with color data by adding the current offsets
QRect adjustedBounds = layer->image()->bounds();
adjustedBounds.adjust(layer->x(), layer->y(), layer->x(), layer->y());
QString filename = d->saveContext->saveDeviceData(layer->projection(), layer->metaData(), adjustedBounds, layer->image()->xRes(), layer->image()->yRes());
QDomElement elt = d->layerStack.createElement("layer");
saveLayerInfo(elt, layer);
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