<div>After reading a post in the Krita forums asking for Impasto, I took a look at the Phong Bumpmap filter with the intent to fix it.</div><div><br></div><div>The filter generates a QImage called "bumpmap", this contains the result of the process() method.</div>
<div><br></div><div>Currently, the filter simply uses this QImage:</div><div><font class="Apple-style-span" face="'courier new', monospace"> device->convertFromQImage(bumpmap, "", applyRect.topLeft().x(), applyRect.topLeft().y());</font></div>
<div><br></div><div>This will only work if "device" is an RGB 8 color space (or maybe in other cases I'm not aware of).</div><div><br></div><div>I've been _trying_ to fix this behavior by storing the information contained in the QImage in an intermediary RGB 8 KisPaintDevice, and then turning this to the colorspace of the target KisPaintDevice...</div>
<div><br></div><div>...but my attempts have not succeeded, this is an example of what I did to replace the former line of code:</div><div><font class="Apple-style-span" face="'courier new', monospace"> KisPaintDeviceSP quickHack = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());</font></div>
<div><span class="Apple-style-span" style="font-family: 'courier new', monospace; "> quickHack->convertFromQImage(bumpmap, "");</span></div><div><font class="Apple-style-span" face="'courier new', monospace"> KisPainter painter(device);</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace"> painter.bitBlt(applyRect.topLeft(), quickHack, applyRect);</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br>
</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">In theory, this should work. I _thought_ that </font><font class="Apple-style-span" face="'courier new', monospace">painter.bitBlt</font><font class="Apple-style-span" face="arial, helvetica, sans-serif"> would convert the </font><font class="Apple-style-span" face="'courier new', monospace">RGB 8</font><font class="Apple-style-span" face="arial, helvetica, sans-serif"> information into whatever colorspace </font><font class="Apple-style-span" face="'courier new', monospace">device</font><font class="Apple-style-span" face="arial, helvetica, sans-serif"> is using. But... this didn't work.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif">With this new code, I only get the expected output from the filter if my image uses an RGB 8 colorspace. With RGB 16 I get garbage, and with other colorspaces I get a crash (I think the crash is a bug from the UI that I need to fix, so I'm just testing with RGB 16 for now). So everything is like before, no improvement.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Any idea of what I'm doing wrong?.</font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">I need a way to turn an RGB 8 bitmap into any other colorspace, I'm sure Krita already handles that, but I don't know how to turn that RGB 8 data into the other colorspaces.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">I am stuck here, so h</font><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; ">elp is greatly appreciated.</span></div>
<div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif; ">Pentalis over and out.</span></div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div>