Archive

Archive for the ‘Open Source’ Category

How to find where an exception is emited with Qt ?

24 February, 2010 Leave a comment

When an exception is thrown and not catched in a Qt application, it get catched by Qt’s event loop, and the following message is displayed in the console:

Qt has caught an exception thrown from an event handler. Throwing exceptions from an event handler is not supported in Qt. You must reimplement QApplication::notify() and catch all exceptions there. terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc

In other situations, std::bad_alloc is replaced by the name of the exception. The problem is that if you now want to know where it happens in your program, the backtrace points to where the exception is rethrown by Qt’s event loop, which is not where the error happens.

I first had this problem a few days ago when implementing multi-layers support in EXR, since the exception name was specific to OpenEXR, I just grepped the code and deduce where the error occurred. But this is not very convenient when the error is generic, like std::bad_alloc which can be thrown just anywhere. And as it turned out by Qt itself in ‘qBadAlloc()’. The solution suggested by Maelcum on IRC is simply to set a breakpoint in the function __cxa_throw, which is a function of the C++ standard library that is actually doing the job when the keyword throw is used (at least with the GNU stdlib++, no idea if it is valid with other standard library implementation). And then you get a backtrace that point to the problem.

I thought I would share this tip in case, in some day, you find yourself with an uncaught exception in a Qt application.

Categories: KDE, Open Source Tags: , , ,

Discussing Krita, digital painting with David Revoy

6 December, 2009 9 comments

For the next releases of Krita, we decided to pick up a specific artist, with a specific work flow, and to implement and fix the issue that he needs. For 2.2 (and probably 2.3), we have chosen David Revoy who has come recently to fame for his involvement in the durian project of the Blender project. Since he lives in Toulouse, and since I still live in Toulouse for the next two weeks, we felt it was a good opportunity to met and to talk about what is Krita, and to get a feel of what he needs.

On Tuesday, after work, I went to his apartment. First he showed me a bit what he needs, especially in a patch to the Gimp that brings much needed feature for him, like the brush that mix its current colour with the content of the layer, or the flow setting (that is similar to krita’s “wash” and “build up” modes, except with a fuzzy settings, while Krita is binary). We also discussed the performance issue, especially comparing to Photoshop. Most digital artist would draw their image at a higher resolution than needed, for instance, if you need an image of 1000×1000, then you will draw it at 2000×2000 or even more, which means that you also scale the brush you use, which means that the brush engine needs to be efficient. While more polishing, like more clever shortcuts and easier setting of painting parameters is a must, efficiency is clearly the biggest issue we are facing in Krita, and the one that will need the most work, the good thing is that we already many solutions that will help us to improve that.

Then I installed Krita on his computer (using the ubuntu KOffice backport, I do not know if I missed something, but I found it extremely hard to add the backport to Ubuntu’s software installer). And I showed him the different paint engine of Krita, especially the new one from Lukas, and I talk to him about the goal of Krita, which is clearly focused on digital painting, and image creation. This is where we can have a clear separation between the different 2D graphics application in the open source world, with Gimp having a focus on image manipulation, mypaint being a scratchpad for quickly drawing, and Krita being focused on digital painting. This does not mean there should not be any features overlap, like Krita having a set of filters for image enhancement. It is just that the focus of the user interface and of the development is different.

This led us to discuss on what he can do to help use make Krita the application he would want to use for his artwork. What we need most (a part from more developers 😉 ) is testing. While 2.1 is a nice release, it is still far from bugs free, but what is also important is testing of the user interface and of the features, we need to know what is lacking. As a developer, when I draw I tend to bend myself to what Krita can do, while it should be the opposite, it is up to the application to fit the work flow. We already have two artists running the development version of Krita, but more is always welcome to get more diverse opinions.

We also talked on funding development of open source software, one area where the Blender Foundation is very successful is to make movies with Blender, this is very good for advertising the product, since you can show awesome end-results. But it is also very good since developers and artists are working together on the movie, the developers fixing bugs and adding needed features, while the artists provide feedback. The Krita pledgie is one step in that direction. David was thinking that targeting windows users could boost the fundraiser campaign, as apparently many artists are having remorse on pirating proprietary software and might be interested in helping a cheaper alternative, but it is clearly not the primary focus of Lukas work, first we have to make Krita ready on Unix, then other platforms will come.

Categories: Krita, Open Source Tags: , , ,

KOffice 2.2 Release Schedule

3 December, 2009 2 comments

One of the outcome of the meeting in Oslo was to take the final decision on the KOffice 2.2 release schedule. Following the current trend of a six months release schedule, therefor the 2.2 RC1 is planned for April, 27th 2010.

We have also decided to experiment with a shorter release schedule for 2.3, which is likely to happen four months after 2.2. This will be made possible with the use of Git, and if we manage to keep the release branch in a releasable state at all time, meaning no tests failures, and that features are only merged when finished.

KOffice Fall Meeting 2009 – Day 2

29 November, 2009 3 comments

People are almost already gone, or are about to leave (myself I am leaving the office in an hour or so). The office is getting empty, the discussion are fading away. But today, started by a presentation from Jos of strigi fame on a metadata project for KWord and KOffice, and a proof of concept implementations of ODF 1.2 metadata, and how to use nepomuk. This trigger a discussion between him and Pierre on a design that could work for change tracking and metadata in the KOffice text library.

The last main topic was about making KOffice ready for end-users. And we decided to define a few use cases with an associated users for each application. And then list the features they need, and what kind of issues they face. While Krita is getting focused on being useful for the artist behind Blender movies. Of course, the biggest challenge is now to find developers resources to implement all this ideas and fixes.

This was the last topic on the general session. Afterward hacking started again, as well as specific discussion between a small group of developers. For instance, the Krita team (or what was left of it after the departure of Dmitry) started a discussion on redesigning our painting operation settings, which are currently a bit messy between GUI elements, and settings used for painting.

And now people are either gone, compiling KOffice on windows or almost asleep.

Categories: Krita, Open Source Tags: , ,

KOffice Fall Meeting 2009 – Day 1

29 November, 2009 1 comment

Yesterday was the first day of the meeting, we had a lot of discussions going on. It started with the move to git, when, what and how ? We decided for a list blocker, and to do the conversion as soon as this blockers were solve, this include solving some of the issues that KDE face for the conversion.

Then we decided to have the 2.2 release on a six monthes schedule, with a release in May, and to experiment a short 4 monthes schedule for 2.3. To be efficient such a schedule require a move to Git, and the ability to work on different branches and only merge what is ready. The main objection to such a schedule was whether it is not too many releases for end users, the advantage is that we solve the problem of schedules alignment with distributions.

Then we had a presentation from the Nokia guys on their work on an Office viewer for Maemo, what they achieved and what they need to have fixed (just 600 bugs…) to consider it end-user ready. And then we talk on how to integrate their work in the community.

Then we went for sandwiches at the Nokia cafeteria.

We started the afternoon with a discussion on how to improve decision making inside the community. The important thing is that we want to take decisions based on a concensus, which require to have people working on finding a solution instead of defending their current solution. But in the end, if there is still a disagreement, we decided that shared component (library and base plugins) would have three maintainers that take the final decision.

In the afternoon, Olivier Goffart gave a presentation on library design, which is interesting since we are planning to export some of our libraries and offer API/ABI stability.

Then we had hacking times, with people fixing bugs, talking design and other discussing on our library organisation.

Then we were invited by Nokia for a pizza party at a nearby restaurant. And concluded the evening with a Krita meeting in the lobby of the hotel.

Categories: KOffice, Open Source Tags: , ,

KOffice Fall Meeting 2009 – Day 0

27 November, 2009 Leave a comment

So I have arrived in Oslo for the KOffice Sprint. We are gathering in the Trolltech headquarter, currently waiting for people to arrive before going to have dinner in the center. Casual discussions have already started about moving to git, about network issues, graphical user interface, distribution flameware. And also doing some hacking.

The topic of the meeting is mostly about finalizing the KOffice libraries, with API reviews with Qt Developers, probably some bug fixing and unit testing. As well as a few “administrative” discussion, like release schedules.

About Krita and Gimp, in default installation

26 November, 2009 16 comments

The removal of GIMP from the default installation of Ubuntu has raised quiet a stir. And as drawn quiet a bit of advertisement for Krita, as some people suggested the use of Krita instead, but for no good reasons, since Krita is not a good replacement for GIMP as a default installation.

You have to consider the use case of the default installation, since the Ubuntu people are trying to make is a distribution that is usefull for the average users, the default installation need to cover the need of the many. And what most people want to do with their picture is to classify them, do light weight retouching (for instance, adjust the brightness, remove red eyes) and then print the image or send it on the Internet. Surely, both Krita and GIMP can do it, but they have way more features than what is needed for most users. As Sven Neumann, one of the core GIMP developer, said GIMP is a high-end application for professionals, and so is Krita. Some might think that Krita has a GUI that is more friendly to the beginner, but that is not the problem, it is still packed with features that are of no interest to most users. And there are tools that are better suited to accomplish the task of those users, this is why a pictures collection management tool, such as F-Spot or Digikam is a much better choice, it covers the main usage of the majority of users. Even if Digikam is designed for professional photographer, I still think it scale nicely to average users. And when the user want to do more with images, he can just go to his favorite package manager, and install GIMP or Krita.

KOffice 2.1 is released, how user ready it is ?

25 November, 2009 2 comments

Yesterday, we released KOffice 2.1, the first major release in the 2.x cycle. It brings many improvements over 2.0, providing a much more stable and rich full experience, you can read more details in the 2.1 release announcement.

While 2.0 was clearly a developer release for developer, and for testing. For 2.1, we concentrated on fixing bugs, fixing some of the annoying issues, 2.1 is coming with many improvements in the MS Office filters, but 2.1 is still lacking in many area, for instance 2.1 comes with experimental support for displaying tables and formulas, but there is no support for editing them. Also there are still many rough edge in the UI. But the progress from 2.0 are astonishing, helped by the good base libraries (Qt, KDE and koffice), external help (Kevin Otten’s student and now Nokia).

While, in general, KOffice 2.1 is still not recommended for end-users. There are two exceptions, the first one is Karbon, while far to be feature full, is starting to become a very capable vector drawing editor, in 2.1 it get support for filters (only blur in 2.1, more is coming for 2.2). I personally use it a lot these days to create illustration for my thesis work. And Krita has made big progress in stability, with dozens of crash fixes for 2.1, and also include many of the new fun painting operation from Lukas, improvement in brush dynamic, recording of filters to create macro…

Krita and XCF

20 November, 2009 2 comments

Last week, I blogged about the removal of the graphics magick file format filter in Krita, and that it would mean that we need to write directly our own support for many file formats, using low-levels library when relevant and available. And by forcing us to do this work, the support for file formats in 2.2 will rock.

Among the three mostly usefull file formats that were delivered by the gmagick file format filter, there is XCF, the file format of the Gimp. After my blog, pusling (Sune Vuorela of the debian KDE team) reminded me about xcftools, a tool written by Henning Makholm that extract information from XCF files. Despite not being a library, the code to parse XCF files is well seperated from the command line logic, and I imported it in Krita (might be a good idea to turn it into a real library ?).

As mentioned, the previous filter was not really good, we were only able to get the layers, but no masks or no composite information, or opacity, as reported in this bug 106730. And with the xcftools based filter, we can read all that information, making XCF a first class citizen in Krita. There might be some issues with composite ops that behaves differently on some cases between application, but that something that we would need to fix as well.

For the other way around, to import from Krita into the Gimp, the OpenRaster Archiving format would be the way to go.

About other file formats, Boudewijn is already working on PSD support. The last important one is GIF support, which will probably be done using libgif.

Categories: Krita, Open Source Tags: , , ,

OpenGTL 0.9.12 and Shiva noise

20 November, 2009 Leave a comment

OpenGTL 0.9.12

Earlier today I made a new release of OpenGTL (download page), version 0.9.12, for that release 23 tasks were completed, the main changes are:

  • Fixing thread safety issues at run time.
  • Progress report.
  • Many new mathematical functions for the Shiva standard library.
  • Replacement of the Shiva kernels random functions.
  • OpenGTL is now compiling and running on Mac OS X.

The first two points are important changes for krita, since the first one meant that with the previous releases we had to use mutex while executing Kernels, preventing to benefit from multi-core. The second one means the user can see something is happening in Krita when a filter is processed.

Random functions in Shiva

This new release also break the Shiva language compared to previous release, I try to prevent that, but since the language is still very young it was bound to happen. In previous releases I quickly introduced a rand() function, because I wanted to write a perlin noise generator. The problem with rand() is that it does not take a seed parameter, meaning that the function use the global seed, meaning that two consecutive call to ther perlin noise generator kernel gives two different results, without any kind of control. For graphics, we need to make sure that the result are reproductible, so now in 0.9.12, the function rand() has been replace by one that takes a seed parameter rand(output int seed).

Such a function is usefull at init time, to construct random structures, like those needed by the perlin noise. But this is not sufficient, we also need a random function that can be used while processing a pixel, and one that would always return the same value for a given pixel and a given seed, for instance to write a salt and pepper noise generator.

The problem of the rand(output int seed) function is that it works by incrementing the seed parameter, so that next time you call it, it gives a different result, so as long as the call are made sequentially it would work fine. But in case of Shiva (or Krita, for that matter), we cannot guarantee that those call will be made sequentially, and it is not possible to keep a value between the computation of two different pixels. Because we might just be interested in generating part of the image, or we might be executing the kernel in a multi-threaded environment. To solve this problem, about six monthes ago, in Krita, we developed an algorithm that takes the pixel coordinate and the seed, and return a pseudo-random number. For 0.9.12, I copied that algorithm in Shiva, giving birth to the second new function for random number generation, which is rand(int x, int y, int seed).

The code for the salt and pepper noise generator is:

kernel Noise
{
  void evaluatePixel(out pixel4 result)
  {
    int x = result.coord.x;
    int y = result.coord.y;
    for(int i = 0; i < 3; ++i)
    {
      result[i] = frand(x, y, 32);
    }
    result.setAlpha( 1.0);
  }
}

The code for the perlin noise generator is slightly more complicated and can be watch in the opengtl mercurial repository.

And the resulting images, salt and pepper noise on the left, and perlin noise on the right: