Realistic drawing with MyPaint

Slashdot it! Delicious Share on Facebook Tweet! Digg!
victoroancea, 123RF

victoroancea, 123RF

Pen & Paper

Using MyPaint and a graphics tablet, you can create or trace drawings with the feel of real pens and brushes. All the necessary tools are included.

MyPaint tries as much as possible to emulate the use of brush and pen in a classic drawing program. Of course, there are limits, but the program provides numerous features that are hard to achieve with analog materials. To fully exploit MyPaint's potential [1], don't operate it with a mouse; instead use a pressure-sensitive input device – typically a graphics tablet.

Modern Linux kernels provide pretty good drive support for Wacom tablets and similar models from other manufacturers, although the latter pale in comparison. The hardware should also be recent enough (maximum five years old) to support the graphics tablet successfully. A first indication of whether Linux supports the device comes with the call to xsetwacom (Listing 1).

Listing 1

List of Devices

$ xsetwacom --list devices
Wacom Bamboo Pen Pad pad        id: 16 type: PAD
Wacom Bamboo Pen Finger touch   id: 17 type: TOUCH
Wacom Bamboo Pen Pen stylus     id: 18 type: STYLUS
Wacom Bamboo Pen Pen eraser     id: 19 type: ERASER

The program comes from the xf86-input-wacom package or some similarly named package in another distribution. If the input device is recognized (it may even appear multiple times), "only" the normal configuration is available. I'll talk more about this in the next two sections.

The description of the device (e.g., Wacom Bamboo Pen Pen… ) may differ depending on your particular equipment. If you can't find the input device through the command, several possible error sources and associated remedies can come into play. The best solution is to seek out a forum for your distribution [2] and look for postings that might help you.

Tablet Setup

Setting up the graphics tablet takes several steps. The kernel needs to load and initialize the module, you define the basic properties in the desktop environment, and the applications need to set up special properties of their own. Getting the kernel to recognize the input device presupposes setting up and enabling its support. This requirement becomes evident when booting and connecting the tablet (Listing 2).

Listing 2

Connecting the Graphics Tablet

[ 104.396599] input: Wacom Bamboo Pen Pen as /devices/pci0000:00/0000:00:\
[ 104.398681] wacom 0003:056A:00D4.0003: hidraw2: \
  USB HID v1.00 Mouse [Wacom Co.,Ltd. CTL-460] on usb-0000:00:1d.0-1.1.3/input0
[ 104.398843] input: Wacom Bamboo Pen Finger as /devices/pci0000:00/0000:00:\
[ 104.399072] input: Wacom Bamboo Pen Pad as /devices/pci0000:00/0000:00:\
[ 104.399391] wacom 0003:056A:00D4.0004: hidraw3: \
  USB HID v1.00 Device [Wacom Co.,Ltd. CTL-460] on usb-0000:00:1d.0-1.1.3/input1

Once the kernel detects the input device, you can configure it using the tools of the desktop environment. In Gnome and Unity, the process is particularly easy. The Control Center has a special tool for configuring (Wacom) graphics tablets (Figure 1). The setup is similar with KDE.

Figure 1: Use the tools of your desktop environment – in this case Unity – to configure the basic graphics tablet settings.

Using the Mouse Tracking function, you can define how the tablet maps to the screen. You would normally use the Tablet (absolute) setting that causes the active area of the tablet to cover the entire screen. In this mode, the screen pointer position corresponds to the pen position on the tablet. Alternatively, you can use the Tablet (relative) mode, where the pointer isn't initially repositioned but moves relative to the pen. This mode works best with small devices and takes a bit more time to operate.

In Assign Screen , you can determine if the pen is supposed to work on selected screens or on all screens. This setting takes into account that graphic users like to have multiple screens open: for drawing, for tools, for settings, and other tasks.

The next step is to adjust the characteristics of the input device. Many Wacom pens come with a built-in virtual eraser. To avoid activating it accidentally, you can set a pressure threshold for it in advance.

The next two settings for the pen buttons are a bit ambiguous. Essentially, you're setting what happens when you press one of the buttons. In most cases, the default setting of emulating mouse button behavior is a good choice. However, you can attach other functions to these buttons. Doing so proves a bit confusing, in that programs such as MyPaint provide similar functionality that then takes over. This functionality might require some slow and methodical adaptive work.

Particularly important is the last slider that you use to set the pressure threshold of the pen, which determines characteristics such as how thickly lines are drawn (Figure 2). MyPaint again has an analogous function.

Figure 2: A characteristic of graphics tablets is that the pen pressure determines the thickness of a drawn line.

In the Terminal

An exception is the Xfce desktop that currently has no tool for configuring graphics tablets. It's therefore desirable to maintain the settings of the Gnome Control Center. This isn't currently the case (with Xfce 4.10), but there is a workaround [3].

Another approach is to use xsetwacom , where you can enter all the supported properties from the command line. To activate absolute mode, for example, you would enter the following:

$ xsetwacom --set "Wacom Bamboo Pen   Pen stylus" mode absolute

Substitute your particular device for the description in quotes. You can also use the keyword modetoggle to toggle between absolute and relative mode. You can define the curve for setting the pressure sensitivity using two anchor points; the keyword is PressureCurve followed by four space-separated parameters. The man pages (man xsetwacom and man 4 wacom ) describe the different configuration options. You can find further details in the Linux Wacom wiki and the Linux Wacom project homepage [5].

The third setup phase is carried out directly in the application using Edit | Settings in MyPaint (Figure 3). The first tab lets you set the pressure sensitivity curve. This function is directly related to the desktop environment setting, so reciprocal actions may occur.

Figure 3: MyPaint lets you configure the pressure sensitivity of the pen and the actions of the pen buttons.

The same goes for the key bindings on the second tab. If you set the default mouse emulation mode in the desktop environment, it's possible to use it here. However, MyPaint supports only key bindings with combined with modifiers such as Ctrl, Alt, and Shift for some keys.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content