prev
Issue 71
12th August 2007
by Danny Allen
next


This Week...
Significant progress in Colour Mixing in Krita. A new, more usable sidebar for okular. International Date Line support, and the merge of Summer of Code work in Marble. Solid is used for hardware detection in Digikam. KRunner uses Strigi for filename-based searches. The ability to switch cursor themes without restarting KDE. Timelines for multiple timezones, rich-text support and other journal improvements in KOrganizer. Support for storing bookmarks in Akonadi. Initial porting of the Kollision game to QGraphicsView. Support for KNewStuff2 in KWordQuiz and KVocTrain; KNewStuff2 support (and the spectrum viewer) removed in Kalzium until KDE 4.1. Initial import of Blitz, an improved graphical effect and filter library for KDE 4.0.

Emanuele Tamponi introduces the innovative work recently committed to Krita, covering paint mixing:
As in last year's Summer of Code, my work was not about writing much code (I'm not a very fast coder), but more about searching and investigating academic technologies that we, the Krita developers, could use for our application.

This year, my project was about a very strange task: color mixing. I have to admit that at first, I thought that the most difficult and important part of my work would have been that of physical simulation of dripping and drying paint, and the simulation of the brush movements. How could mixing colors be so difficult?! Take their RGB values, and mix them additively or with some other simple transformation (the HSL color model is very useful, for example). But things are not so easy.

Color mixing is indeed a very difficult task. What is it exactly? It's about simulating what you learn at school: yellow and blue give green, red and yellow give orange... and so on. I have to simulate this behavior.

It's very difficult to explain the complexity in a few words, but it can be simplified this way: you can *not* know the final color of a mixture knowing only the RGB values of the components. So my work was: find a "color model" (that is, a way to represent colors) that has this property: the color of a mixture is the weighted sum of the values of the components.

Luckily, other people thought about this before me, in particular two researchers, Kubelka and Munk. They wrote a set of differential equations that describe (among other things) the behavior of pigments. The integration of these equations brings to another set, that permits the application to decide the color that would be viewed by mixing some components. Kubelka and Munk didn't see that their system has the property I was looking for: this discovery was made by Duncan, one of the guys that integrated their equations. His law states exactly what I was looking for: "the K and S values of a mixture are equal to the weighted sum of the K and S values of the components". K and S values stand for "Absorption" (K) and "Scattering (S). Again, it was not so easy to come to this: really, since the beginning I hoped that I could use some other systems instead of of Kubelka and Munk's one, because it's very complicated. I hoped that some simplifications were good enough to approximate the real behavior of paint without using their model.

At the end, it was evident that I could not escape from Kubelka and Munk, and so, I started implementing their theory. Many parts of it are very well documented: there is a good set of equations that permits transformation from K and S values to Reflectance values, and then from these to XYZ values, and from these to RGB values. Perfect! No, not exactly :-) Because I needed also exactly the opposite: a way to transform from RGB to K and S, and *then* viceversa :-) All papers I read gave K and S values as known, and didn't give me any hints on how to find them from RGB values.

Luckily again, after some search, I found a little, old paper that talked about this: the algorithm I found reading it isn't perfect, but it does work. I was able, after some (*much*) maths (thanks to Paolo Capriotti for his fuundamental help), to obtain these K and S values!

This happened just some days ago, when I committed the latest version of my mixer. Once I obtainted these values, finding the resulting color is really easy: just take the amount of paint for each component, and mix their K and S values proportionally to their presence... the final result is very realistic. For example, this model is the only way I found to obtain green from yellow and blue.
Download Krita Colour Mixing video (8.5 MB, AVI)



Krita is the first public application that implements this technology. Only some other academic projects have managed this, and with a lot of CPU/GPU consumption (they need a cluster or a powerful GPU, or they would run only at very low resolutions). I suceeded in simplificating the process enough to run it on all machines I have, without using the GPU at all (and I have no clusters in my house :-)). Corel Painter doesn't do this (in fact, I guess that it can't mix as well as Krita now...), Photoshop doesn't do this.

With this technology, we can not only handle correct mixing from RGB values, but also the creation of *real* colors (that is, color defined not only by their RGB values, but also by their "Reflectance", that's the main and fundamental property that gives a color its... color); we can handle illumination, that is: changing the virtual light that illuminates the scene will change the colors present in it. A very good set of features, they are not implemented yet but the infrastructure is here.


Statistics
Commits: 2590 by 223 developers, 7002 lines modified, 1619 new files.
Open Bugs: 14162
Open Wishes: 12903
Bugs Opened: 181 in the last 7 days.
Bugs Closed: 120 in the last 7 days.

Commit Summary
Module Commits
/trunk/KDE
885
/trunk/l10n-kde4
381
/trunk/playground
346
/trunk/koffice
217
/branches/work
181
/trunk/extragear
97
/branches/stable
93
/trunk/kdesupport
70
/branches/extragear
64
/trunk/l10n-kde3
63
Lines Developer Commits
1025
Mirko Boehm
239
294
Laurent Montel
154
154
Pino Toscano
69
177
Allen Winter
63
122
Andreas Pakulat
55
194
Stefan Nikolaus
46
38
Jeremy Paul Whiting
38
327
Torsten Rahn
36
34
David Nolden
34
92
David Faure
33

Internationalisation (i18n) Status
Language Percentage Complete
Swedish
99.58%
Portuguese
98.72%
Japanese
94.13%
Greek
93.06%
Chinese Traditional
89.46%
Spanish
84.88%
German
82.31%
Dutch
76.38%
Farsi/Persian
75.70%
Catalan
73.33%

Bug Killers and Buzz
Bug Killer Number Of Bugs Closed
Bram Schoenmakers
24
Stefan Nikolaus
21
Rolf Eike Beer
13
Tommi Tervo
12
Pino Toscano
12
Thomas McGuire
11
Jan Kundrát
9
Bruno Virlet
8
Mark Kretschmann
6
Joris Guisson
5

Program Buzz
Amarok
  6305
K3B
  5640
KMail
  5120
Kopete
  4330
Kontact
  3948
Kate
  3880
KDevelop
  3205
digiKam
  2798
Kicker
  2436
SuperKaramba
  2154


Person Buzz
David Faure
  856
Sebastian Kügler
  854
Stephan Kulow
  771
Matthias Kretz
  654
Adriaan de Groot
  630
Allen Winter
  629
Waldo Bastian
  440
Aaron J. Seigo
  364
Boudewijn Rempt
  340
George Staikos
  322
Commit Countries

Commit Demographics
Sex
97.6 %       Male
3.08 %       (unknown)
0.352 %       Female
Motivation
45.2 %       (unknown)
39.6 %       Volunteer
16.1 %       Commercial
 
Ages
69.5 %       (unknown)
14.5 %       25 to 34
10.6 %       18 to 24
3.30 %       35 to 44
2.77 %       45 to 54
0.308 %       Under 18


Contents
  Bug Fixes Features Optimise Security Other
Accessibility
Development Tools [*] [*] [*]
Educational [*] [*]
Graphics [*] [*] [*]
KDE-Base [*] [*] [*] [*]
KDE-PIM [*] [*] [*]
Office [*] [*] [*]
Konqueror
Multimedia [*] [*]
Networking Tools [*] [*] [*]
User Interface [*] [*]
Utilities [*] [*] [*]
Games [*] [*] [*]
Other [*] [*]


Bug Fixes
KDE-Base
Charles Samuels committed a change to /branches/KDE/3.5/kdelibs/khtml/dom/dom2_events.cpp:
the js keyboard event (mozilla extension) property event returns 0 if the key pressed cannot be expressed as an ascii code (apparently).

This behavior is the same as Firefox, /more/ similar to Opera (although opera appears to have an implementation of "event" more buggy than konqueror as a result of this patch). I figure firefox's implementation is canonical as it's a gecko extension.

Still, there's a remaining bug in that you can't send "ctrl-something" because Konqueror filters it away from the Part. I'm not going to fix that.
Diff Revision 696502

Allan Sandfeld Jensen committed a change to /trunk/KDE/kdelibs/khtml/rendering/enumerate.cpp:
Fix bugs/clarifications in list-style: georgian and lower-greek
Matches Firefox and Opera now
Diff Revision 696609

Daniel Teske committed changes in /trunk/KDE/kdebase/apps/konqueror/src:
Rewrite the filtered bookmark toolbar code.
The quite commonly reported bug that the icon is not shown in such a filtered bar is fixed. Actions on the bookmark now really change the underlying bookmark
that is, you can change the e.g. title and the bookmark in the menu is changed.

Stop using the KXBelImporter class, a temporary KBookmarkManager and the visitor pattern, which unecessary complicated the code.
Diffs: 1, 2 Revision 696665

Peter Penz committed changes in /trunk/KDE/kdebase/apps/dolphin/src:
Fixed 'Select All' and 'Invert Selection' for the column view (only the items of the currently active column will be selected, not the whole tree). The current implementation is quite slow, but this will be fixed later.
Diffs: 1, 2, 3, 4 Revision 696893

David Faure committed changes in /branches/KDE/3.5/kdebase/konqueror:
When loading a new url into an existing view, don't update the location bar immediately, but when starting to load it into the view for real. This fixes:
- click on link which opens in new app: the url was shown temporarily and then reverted
- constant redirects would keep updating the location bar url, masking the current url
But we still show the url immediately when loading a url into a new window or tab, for early user feedback.

Also fixed double-part-activation bug which was clearing up the url temporarily during startup (and slowing down startup, too, since AFAICS it was doing xmlgui-building twice for KHTML).
Diffs: 1, 2 Revision 698562

KDE-PIM
Thomas McGuire committed changes in /trunk/KDE/kdepim:
Fix display of vcard attachments in KMail.
The problem was that the old content-type was text/x-vcard, and the new one is text/directory.

To fix this, the following was changed:
- the vcard plugin now works for x-vcard/vcard/directory
- a new directory subtype has been added to mimelib
- parseMsg() also checks for both x-vcard and directory