Fun with Krita: Spray

I coded some funny stuff for a paintop called spray. The idea behind it was that I wanted to add a “killer” feature to krita — spray that behaves like MS Paint spray. But then I added support for anti-aliased pixels, then I added support for shapes and it started to be fun, so I added more features. So here is what you can paint with it when you compile from trunk:

Sprayed rectangles and ellipses


First two images are post-processed. The second one with deform brush and both are filtered with Filter->Enhance->Mean Removal filter in Krita.

Let me describe the spray brush a little. Default values are in braces.

First GUI dialog sets information about the area you will spray. So you setup the diameter (100 pixel) of the circle area where you are going to spray, you specify how much percent of the area should be sprayed (0,001 % of the circle volume) This attribute will be probably changed to exact number of objects you want to spray probably, so far it is adaptive to the diameter of the circle.

Then you can turn on jitter of the movement. So when you spray, spray brush shake with your position. You can specify how far he will shake.

Spacing is feature known from others brush engines, so you probably know it. It sets spacing for the your spray area. And you can scale the area with scale. It scales positions of sprayed objects towards centre of your spray area.

Next GUI screen is Spray Object. Here you can specify what will be sprayed. You can select Pixel (do you remember MS Paint spray, this is how it looks in krita 😉 ), Particle (anti-aliased pixel) and Shape (default). So far there are 3 shapes (circle, pixel, anti-aliased pixel – particle). You can specify shape size and jitter size means that object will be sprayed with random size from 1 to dimensions you specify. Objects are rotated according the centre of you spray brush.

Demo of the spray shapes

I added rate option for freehand tool, so you can specify how fast the spray sprays, but it works for now just when you don’t generate events, which means when you just press your left mouse button and you don’t move. You specify milliseconds.

I hope you enjoy pictures and now go and make some own and you are welcome to share them in comments 😉

Lukáš Tvrdý

This entry was posted in Krita. Bookmark the permalink.

7 Responses to Fun with Krita: Spray

  1. Morphiax says:

    It would be cool if Krita could do brushes like ZBrush

    How difficult would this be do you think?

  2. LukasT says:

    ZBrush looks more like a 3D sculpting tool. You may be interested in Blender, they have some similar tool available called Sculpt tool. See
    Krita is for 2D painting. Maybe with 3D brush in future 😉

  3. maninalift says:

    > It would be cool if rather than merely specifying “radius” you could select a distribution for your spray, then set the parameters. e.g. “Gaussian”, then set [std deviation] (spread) (or better a general 2D Gaussian: set [angle of major axis], [eccentricity] and [standard deviation]), or “uniform rectangle” then set [angle] [length] [width], “uniform ellipse” etc.. You could even have a spray that spits out points according to a monochrome bitmap ( )

    > You could also have a selectable functions for the orientation of particles.

    > Particles themselves are just a thing rendered at a given point at a given angle (at a given intensity ?) and so I guess could be rendered with (any?) krita brush

    There is loads that could be done. fun fun fun.

    Oh… also you could add global randomness / variation… a flexible way to do this is to make it so that any variable that you can modify can either be “static” i.e. you just input the value as normal or you can select from one of a set of dynamic options (sinusoidal, memoryless random, constrained diffusion… )


  4. Svempa says:

    Could perhaps be neat if one could use random colours (like, “I want the hue (or red component, or whatever) to change randomly within a span of X%). Or maybe not. I have some trouble visualizing the results. 😉

  5. LukasT says:

    @maninalift: Good ones, I will try some of them 😉

    @Svempa: Could perhaps be neat if one could use random colours
    I have got already code for it, but I need to find out how to integrate it into spray

  6. Bugsbane says:

    I just want all these variables to be able to be hooked up to tablet pressure.

    That is all. :)

  7. Pingback: Links 06/04/2009: IBM Withdraws Sun Offer, Linux Gets FS-Cache | Boycott Novell

Leave a Reply