PaintOp and accessing pixels

LukasT.dev@gmail.com lukast.dev at gmail.com
Thu Oct 16 23:18:22 CEST 2008


Hello,

I started to develop deform paintop (something like iWrap in gimp) and I 
got problems with accessing pixels from current node.
The brush deform image with inverse wrapping, it just move with pixels 
and should produce fun results from photos. I have implemented it these 
days in OpenCV,
so I decided to implement it like a brush in Krita. I respect feature 
freeze.

But how do i access that pixels?

The actual status is that e.g. my hairy brush is trying to access pixels 
from layer using
painter->device() method which is invoked inside paintLine in kis_sumiebrush

The results are two:
a) Paint incrementaly in GUI not checked
Brush produce just black pixels which are bitblt on the layer -- I 
suppose, that no pixels are read from layer and I don't know why
the color of hairs is black.

b) Paint incrementaly checked in GUI
Brush (when paint in brush.cpp uses mixCMYK) access just pixels that has 
already painted through the one stroke and is able to mix them together.


Now I investigate sources and I was trying to do this:
I'm painting with method myPaint(KisPaintDeviceSP dab, KisPaintDeviceSP 
layer, KisInfo...)
I created two random accessors, one used for reading (random accessor 
for layer) and one for writing (random accessor for dab).

The result is that when i use layer as painter->device(), I don't get 
access to pixels in current layer...
I was trying to use KisPaintOpSettings::node(), but that returns 
KisNodeSP. What is KisNode used for?
I also found currentNode()->paintDevice() in freehand tool . I was not 
able to understand how do I send it to my paintOp...

Duplicate paintop access pixels, but actually it crashes, slangkamp told 
me because of refactor of paintops..
I did not find any paintop that reads pixels from node and actually works..

Could you explain it to me? I spend some time and I was not able to came 
up with solution...

Have a nice day
Lukas


More information about the kimageshop mailing list