<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 &quot;bumpmap&quot;, 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="&#39;courier new&#39;, monospace">    device-&gt;convertFromQImage(bumpmap, &quot;&quot;, applyRect.topLeft().x(), applyRect.topLeft().y());</font></div>
<div><br></div><div>This will only work if &quot;device&quot; is an RGB 8 color space (or maybe in other cases I&#39;m not aware of).</div><div><br></div><div>I&#39;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="&#39;courier new&#39;, monospace">    KisPaintDeviceSP quickHack = new KisPaintDevice(KoColorSpaceRegistry::instance()-&gt;rgb8());</font></div>
<div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">    quickHack-&gt;convertFromQImage(bumpmap, &quot;&quot;);</span></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    KisPainter painter(device);</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, 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="&#39;courier new&#39;, monospace">painter.bitBlt</font><font class="Apple-style-span" face="arial, helvetica, sans-serif"> would convert the </font><font class="Apple-style-span" face="&#39;courier new&#39;, 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="&#39;courier new&#39;, monospace">device</font><font class="Apple-style-span" face="arial, helvetica, sans-serif"> is using. But... this didn&#39;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&#39;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&#39;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&#39;m sure Krita already handles that, but I don&#39;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>