Pressure sensitivity

Patrick Julien freak at codepimps.org
Mon Jan 19 22:49:23 CET 2004


On January 19, 2004 04:44 pm, Boudewijn Rempt wrote:
> On Monday 19 January 2004 22:36, Patrick Julien wrote:
> > What do you mean replacing the bitBlt code with a more direct alpha mask?
>
> Well, not obviously replacing the code as such: it's necessary for a lot of
> things.
>
> What I do now is create a temporary layer in which I combine the brush
> shape and a colour; this layer is bitBlted onto the current layer. This
> gets tiresome pretty soon when you realize that there can be up to 255
> sizes of each brush if you consider pressure sensitivity (Qt provides 255
> levels). Caching that amount of masks is just about doable (in fact, I
> cache only half that), but caching that amount of pre-combined dabs is a
> bit much. (Or perhaps not, I haven't tried it yet -- but you need to create
> a dab for every colour you paint with, and then there's the problem of
> gradients.)
>
> What I am going to try is to add something like as maskBlt that uses the
> brush mask as an alpha control for selecting between the current color
> (with 100% opacity) and the existing contents of the layer. I.e, take mask
> and current colour to the colour strategy and do the combining there.
>
> That should give a speed-up, and make it easier to work with gradients,
> too.

Yes, I undestand, what you want is to implement another composite op in 
bitBlt.

You may want to investigate having bitBlt's in QPainter that take different 
arguments for the source (QImage and QPixmap directly) so you don't have to 
worry about using temporary layers.




More information about the kimageshop mailing list