[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-23 Thread Razvan Radulescu
https://bugs.kde.org/show_bug.cgi?id=402382

Razvan Radulescu  changed:

   What|Removed |Added

 Resolution|--- |NOT A BUG
 Status|REPORTED|RESOLVED

--- Comment #8 from Razvan Radulescu  ---
OK so I think we went through a lot in the IRC chat. I'll have to book mark
this for later, the script is really helpful.

At the end of the day it's because of Node.setColorProfile() and likewise I
tried Document.setColorProfile() with no luck.

As for the file layer I've tried another .kra file so that was the issue there.
I'm going to close this as pretty much all has been answered, as much as it
could have been :)

Thanks for all the help Wolthera

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

--- Comment #7 from wolthera  ---
And by reproduce I mean it is sorta expected with Node::pixeldata, the bug
would only be if it happened with node::projectionpixeldata.

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

wolthera  changed:

   What|Removed |Added

 Resolution|FIXED   |---
 Ever confirmed|1   |0
 Status|RESOLVED|REPORTED

--- Comment #6 from wolthera  ---
Ok, I've fixed both issues I've found. I can only reproduce this bug when I use
Node::pixelData, but not with Node::projectionPixelData now. Please check.

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

wolthera  changed:

   What|Removed |Added

 Resolution|--- |FIXED
  Latest Commit||https://commits.kde.org/kri
   ||ta/301ebfc6ef375cda5a8f9997
   ||cffa8bcdea63f145
 Status|CONFIRMED   |RESOLVED

--- Comment #5 from wolthera  ---
Git commit 301ebfc6ef375cda5a8f9997cffa8bcdea63f145 by Wolthera van Hövell tot
Westerflier.
Committed on 21/01/2019 at 17:09.
Pushed by woltherav into branch 'master'.

Return the colorspace of the projection before returning the colorspace of the
node.

This is necessary to access the alpha color space of the mask and transparency
masks. This way the
user can first convert a layer to that colorspace, then copy over the bytearray
and then convert back.

This works with both projectionPixelData and regular pixelData.

Auditors: rempt

M  +6-3libs/libkis/Node.cpp

https://commits.kde.org/krita/301ebfc6ef375cda5a8f9997cffa8bcdea63f145

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

--- Comment #4 from wolthera  ---
Git commit c90bdf5301ca24460c0039e642860c01ac754605 by Wolthera van Hövell tot
Westerflier.
Committed on 21/01/2019 at 16:50.
Pushed by woltherav into branch 'master'.

Fix crash when trying to access projectionpixeldata on transform mask.

This one was found when trying to figure out whether projection data works
properly.

M  +2-0libs/libkis/Node.cpp

https://commits.kde.org/krita/c90bdf5301ca24460c0039e642860c01ac754605

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

wolthera  changed:

   What|Removed |Added

 Status|REPORTED|CONFIRMED
 Ever confirmed|0   |1

--- Comment #3 from wolthera  ---
My script cannot reproduce with the test file offered by Razvan, there must be
an issue with his script.

That said, the transparency, filter and selection masks need to report the
appropriate color model for the bytearray they deliver(this is currently
incorrect, it delivers a Alpha colorspace bytearray, but reports RGBA).

Also, we need to stop the transform mask from crashing when requesting
projection data.

I'll set it confirmed for those two.

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

--- Comment #2 from wolthera  ---
Created attachment 117597
  --> https://bugs.kde.org/attachment.cgi?id=117597=edit
Other test kra file

Okay, I made a test file and a test script. The script basically copies the
pixeldata to a seperate document.

I am not seeing any issues with vector, clone, file or group layers. I am
seeing issues with mask-style layers, and I am seeing crashes when we call
projectionPixelData on transform masks. Colorize masks work sensibly. I guess
this is caused by colorize masks having an rgba color projection, while the
alpha based masks do not. These alpha based masks report the color model as
RGBA despite them being alpha cs too...

Note that the below script would need to be modified to handle multiple depths,
so groups inside groups, but it should otherwise work for most files.
-
from krita import *

doc =  Application.activeDocument()

destDoc = Application.createDocument(doc.width(), doc.height(), "projection",
doc.colorModel(), doc.colorDepth(), doc.colorProfile(), doc.resolution())

for node in doc.rootNode().childNodes():
newNode = destDoc.createNode(node.type(), "paintlayer")
ba = node.projectionPixelData(0, 0, doc.width(), doc.height())
newNode.setPixelData(ba, 0, 0, doc.width(), doc.height())
print(node.type(), node.name(), node.colorModel(), ba.size())
destDoc.rootNode().addChildNode(newNode, None)
if len(node.childNodes())>0:
for childNode in node.childNodes():
if str(childNode.type()) != "transformmask":
newNode = destDoc.createNode(childNode.type(), "paintlayer")
ba = childNode.projectionPixelData(0, 0, doc.width(),
doc.height())
print(childNode.type(), childNode.name(),
childNode.colorModel(), ba.size())
newNode.setPixelData(ba, 0, 0, doc.width(), doc.height())
destDoc.rootNode().addChildNode(newNode, None)

destDoc.refreshProjection()
Application.activeWindow().addView(destDoc)

-- 
You are receiving this mail because:
You are watching all bug changes.

[krita] [Bug 402382] Node::projectionPixelData returns 0s for grouplayer and wrong data for filelayer

2019-01-21 Thread wolthera
https://bugs.kde.org/show_bug.cgi?id=402382

wolthera  changed:

   What|Removed |Added

 CC||griffinval...@gmail.com

--- Comment #1 from wolthera  ---
That group layers don't work is weird because it does seem to work in the
save_group_layers function in layers->export, in code as
'KisSaveGroupVisitor.cpp)

-

KisImageSP dst = new KisImage(exportDocument->createUndoStore(), r.width(),
r.height(), m_image->colorSpace(), layer->name());
  dst->setResolution(m_image->xRes(), m_image->yRes());
  exportDocument->setCurrentImage(dst);
  KisPaintLayer* paintLayer = new KisPaintLayer(dst, "projection",
layer->opacity());
  KisPainter gc(paintLayer->paintDevice());
  gc.bitBlt(QPoint(0, 0), layer->projection(), r);
  dst->addNode(paintLayer, dst->rootLayer(), KisLayerSP(0));

  dst->refreshGraph();


File layer in turn use the projection() defined in Kis_Layer.cc, which is also
used by clone layers.

I'm at this point going to do a test script first.

-- 
You are receiving this mail because:
You are watching all bug changes.