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.
The filter generates a QImage called "bumpmap", this contains the result of the process() method.
Currently, the filter simply uses this QImage:
device->convertFromQImage(bumpmap, "", applyRect.topLeft().x(), applyRect.topLeft().y());
This will only work if "device" is an RGB 8 color space (or maybe in other cases I'm not aware of).
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...
...but my attempts have not succeeded, this is an example of what I did to replace the former line of code:
KisPaintDeviceSP quickHack = new KisPaintDevice(KoColorSpaceRegistry::instance()->rgb8());
quickHack->convertFromQImage(bumpmap, "");
KisPainter painter(device);
painter.bitBlt(applyRect.topLeft(), quickHack, applyRect);
In theory, this should work. I _thought_ that painter.bitBlt would convert the RGB 8 information into whatever colorspace device is using. But... this didn't work.
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.
Any idea of what I'm doing wrong?.
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.
I am stuck here, so help is greatly appreciated.