GSoC/GCI Archive
Google Code-in 2010 KDE

Create a Simple Mixing Brush, Bonus Stage 1

completed by: Natan Yellin

mentors: Pentalis

PREAMBLE

Krita is a KDE program for sketching and painting, offering an end–to–end solution for creating digital paintings.

In Krita, brush engines are known as 'painting operations' or paintops for short. Each paintop is a plugin, a piece of code that's not fundamental to build Krita, but can be added for extra functionality (in this case, the extra functionality is a new brush engine).

Historically, Krita is missing a mixing brush, the closest to color mixing in the current collection of brushes is the smudge brush.

In this epic journey, your mission is to put an end to this lack of a mixing brush, one task at a time. This 'campaign mode' task is divided in several stages such that others can continue if the first contributor leaves, and to let you claim credit for several tasks if you complete the whole campaign.

 

ATTUNEMENT TASK

***You must complete this task before you can claim any task in this campaign***

Mission: Get Krita to build on your computer.

Instructions:

http://wiki.koffice.org/index.php?title=Build_KOffice

You need a working GNU/Linux install in your computer.

 

THE BONUS TASK

***Complete Stage 1 first to claim this***

Stage: 1 bonus

Mission: Create a minimal (empty) paintop, reusable as a basis for new ones.

Instructions: Clone your paintop again but this time give it a generic name, and strip it down to only the minimal components, such that it can serve as a basis for new paintops by following a procedure similar to Stage 1.

Step by step guide:

--Follow the same steps from Stage 1.

--Delete all classes that are not part of the basics for a paintop. How to tell what is basic and what not?, Use trial and error. By repeatedly compiling after modifications to the paintop's source code you can tell which part does what. Now, if you are completely lost, you can also check the hints...

--Hints:

  • 3d_pencil.mtl and .obj -- not needed

  • chalk_brush.h and .cpp -- they implement details about this specific brush, it is not a part of a generic paintop, delete it.

  • chalk_paintop_plugin.h and .cpp -- if you read the introduction, you know that paintops are plugins, so what does the name of this class tell you?. It is basic, you must not erase it. Part of the magic is done by K_PLUGIN_FACTORY and K_EXPORT_PLUGIN, those commands create a plugin factory. Every time a given plugin needs to be called by Krita's code, the factory creates a copy of it to be used, then it is later destroyed. You do not need to understand this, you just need to know it so you can keep an eye for the words 'factory' and 'export plugin' in Krita's code.

  • kis_chalkop_option -- this file describes the basic structure of the configuration popup for the chalk brush engine, it (well, a similar file) also describes the basics for every brush engine out there. So, do not erase it, it is basic. If you open Krita and try to open the configuration popup dialog for any paintop, what you'll see is the product of this class (or their equivalents for every paintop).

  • kis_chalk_paintop -- don't erase, this declares the chalk paintop itself, it should be self-evident from the name: you know that brush engines are called paintops and that class names try to be descriptive => don't erase the class with the word "paintop" in it.

  • kis_chalk_paintop_settings -- this describes a specific widget to configure the chalk brush engine; it is not part of a generic class, every paintop needs its own widgets, so, delete this. (If you want to see how the widget looks, check wdgchalkoptions.ui, open it with QtDesigner4).

  • wdgchalkoptions.ui -- see above.

  • kis_chalk_paintop_settings_widget -- best buddies with kis_chalk_paintop_settings, it is brush specific so erase it.

--You may have noticed some inconsistency with the "kis_" prefix. If you want to maximize brush prettyness, give all your files the "krita_" prefix. "kis" comes from Krita's old name, K Image Shop; nobody calls it by that name anymore, it is obsolete, old, and ugly, and begs desperately to be replaced.

--If you feel lost consult your mentor.

IRC channel: #Krita at irc.freenode.net