Thursday, 1 September 2016

Building Krita 3.0 for lazy cats

This guide only applies to Ubuntu 15.10 and 16.04 (and maybe other up-to-date debian derivatives).

So you are wanting to build Krita from scratch, but don't want all the headache of figuring out paths to installed software that you might or might not have, or figuring out which packages you need? Well, here is a guide to build Krita from a completely fresh Ubuntu install, so you are sure to get it working after following all steps. I hope this guide is useful to people who experience issues with other guides.

The first thing we need to do is make sure our package manager is aware of all the newest updates. Then we download all the required packages for the whole process.

Now we set up our building folder structure. We need a base installation directory, which we set in the first line. Currently, it is set to make a folder called Krita in your home directory, if you want it anywhere else, change the path of the first command and the rest of the commands are still valid. In the base directory we make 4 folders (b, d, i, build). Here is a short explanation what they are for:
  • b - Used to build Krita dependencies
  • d - Used to download Krita dependencies
  • build - Used to build Krita
  • i - Used to install Krita and its dependencies
Krita uses the Qt framework for its user interface. We could install Qt directly into our Ubuntu, but sometimes it's better to have a contained portable installation. This is especially useful because Krita might upgrade Qt versions every so often, so you can easily rerun part of this tutorial to build with a different version of Qt. So we are going to build it ourselves. Luckily, it is quite straight-forward.

In addition to Qt, Krita has several other dependencies that we can automatically resolve once we have the source code, so let's download that from Git. This will create another folder called krita in our base installation directory, and it will contain the source code.

Krita has a couple of dependencies we can resolve automatically, this is why we have a b and d folder.

Now we can build and run Krita.

If you followed all the steps, you should now have a working Krita build. Let me know down below whether this worked for you :)


Google Summer of Code

The Google Summer of Code for Krita is officially over.  I started a bit later due to my graduation, so therefore I will continue for two more weeks. Anyways, here is a little recap of what we achieved so far.

In Krita 3.0 we introduced some mechanisms that required the use of modern OpenGL functions. Using these modern OpenGL functions didn't turn out to be a problem on Windows and Linux. However, on Mac OS it forced us to switch to an OpenGL 3+ Core Profile in order to have access to these functions. This Core Profile also meant that all legacy functions would be illegal to use.

Krita is built on top of the Qt GUI framework, which we use for our whole user interface. Additionally, we use its QPainter class for drawing simple shapes, curves and lines. This class is very useful for rendering our painting assistants e.g. the perspective grid, vanishing point, ruler. Unfortunately, it uses these illegal legacy functions.

Over my Google Summer of Code period I have gone into the depths of Qt and upgraded their legacy OpenGL code to a modern variety. This allows people who explicitly request a modern OpenGL context to still use this useful QPainter class.

The result of this is that we can now fully support Krita's functionality on Mac OS. Whereas previously we had to disable Instant Preview to allow the user to still see canvas decorations and painting assistants, we can now offer both again.

It might take a while for Qt to release my patch in any of their official releases, so therefore we have decided to apply the patch manually to a custom version of Qt we already ship with Krita. This version should be available to you on the Krita 3.1 release.

The State of Mac OS

Over the past weekend many people from all over the world came together at the Krita Institute to discuss all sorts of matters. Several of these matters were about Krita bugs on Mac.

Some of you Mac + Krita users may be familiar with a bug that causes a lot of patches to appear on your screen. You might see interruptions in your paint strokes, parts that are partially transparent or full blown missing rectangles.
Together with Dmitry, Boud and Beelzy we looked at what might be causing these issues.

We have some idea of what is causing the problem, but it is a difficult bug to completely cure. As a temporary solution we have implemented a hot-fix that solves the problem. We are looking forward to feedback on whether this fix is appropriate.

In addition, Beelzy fixed a bug that caused blobs to appear at the beginning of tablet strokes.

Overall the state of Krita on Macs should be improved after the 3.1.0 release, but we will closely monitor any new problems.