Week 31: Fixing custom and predefined brushes

Custom brush was disabled feature for quite a long time in Krita and I resurrected the feature from the dust in week 30. Further testing uncovered a lot of bugs.

First bug occurred when you used color mask as grayscale mask. The mip-mapping levels were still grayscale when you returned from grayscale mode to color mode, so the brush looked grayscale even when you wanted to paint in color. Fixed.

When you paint in mode “Use color as mask” with some predefined brush, the colorful image is converted into gray scale image first. But for the mip-mapping it is converted to masks, where white means transparent and black means opaque. We had bug in computing grayscale-convert-to-mask. Fixed. Another use-case when we convert color image is when we create custom brushes. You can save colorful brush (with RGBA) and then paint with it as mask if you want with Use color as mask mode or you can select Use color as mask in the custom dialog and the brush will be saved as grayscale. In the later option your brush file (gbr) is smaller. The workflow was broken. Fixed. Professional digital painters usually use grayscale masks. Colorful masks are on the other hand used by me when I’m trying to do crazy colorful stuff with spray brush (e.g. HSV transformation is fun with colorful masks).

Then I fixed the saving of the gbr with Krita. Gbr stands for Gimp brush. We were saving gbr brushes in wrong format, usually just the name, which has to be in UTF8, was saved wrong and was corrupted. I had nice opportunity to look at GIMP code. ANSI C! Fixed.

GIH Brush scaled!GIH brush scaling works now

When we saved the GBR brush, we used just random name for it. It was code to avoid name conflicts. We use different strategy with presets. If the name conflicts, we append number til we don’t conflict. First I fixed our strategy for brush engine presets, first let’s try saving the file with name specified, then add numbers only if in conflict and then I added this behavior to custom brush dialog.

Creating brush engine presets for the dialog Custom brush is not usable. You usually use custom brush dialog as editor for creating the bitmap brushes, which are, if usable for you, added to predefined brush dialog. Then you can select the new created brush and make some useful preset for it. I fixed the UI – I disabled the saving button for saving preset when you are in Custom brush dialog. We have some UI defects in Krita, we have to fix them so that user is not confused.

I was admiring David’s latest work, Alice. I kinda missed that Krita was not used so when David was around, I pinged him on IRC at #krita, what bugs him in Krita these days (he use trunk). He replied:
o scaling the predefined brushes does not work for grb/gih brushes on canvas
o option for canvas border color
o global curve for pressure mapping

I looked at the Shift-drag feature (my internal name for changing the size of the brush on canvas – you press shift and you start to drag the mouse to change the diameter). I fixed it for
predefined brushes. But scaling for GIH brushes was not implemented. GIH stands for Gimp Image Hose. So I added the code and now also GIH brushes are scaled! Slangkamp did some testing and he found some bug when you reset the boundery (e.g. it is triggered by Use color as mask checking) and the scale != 1.0, the brush outline was wrong. Fixed. And that was the end of the week.

I will continue with global curve and if nobody takes over, I will implement also the option for color of the canvas border. I go to holiday this week (no computer, just N900) , but good news! I will work on Krita even in September! It will be focused on Krita stability. A lot of excitement in Krita development! Krita rocks!

This entry was posted in Krita. Bookmark the permalink.

3 Responses to Week 31: Fixing custom and predefined brushes

  1. Silvio Grosso says:

    WOW! Your list of bugs fixed is impressive 😉 :-)

    I hope you will work on Krita, fixing bugs, in October too: you know what I mean 😉

    Enjoy your holidays: you deserve them!

  2. Markus says:

    Really, really impressive…

Leave a Reply