Paintops/Hatching brush

From KDE Community Wiki
Revision as of 18:38, 12 July 2010 by Pentalis (talk | contribs)

Early documentation for the Hatching brush.

Last updated: Pentalis 14:40, 27 June 2010 (PDT)

Hatching Options

The image attached is enough to explain the basic 5 parameters:

  • Angle: tilt of the lines in degrees.
  • Separation: distance between a line and the next in pixels.
  • Thickness: thickness of the lines in pixels.
  • Origin X and Origin Y: see below.

Origin X and Origin Y determine the position of the Base point in the Base line (just look at the image). The Base line is the first thing the algorithm "imagines". It will then imagine other nearby lines until it finds one with a segment visible in a hatching area. The remaining lines with visible segments are found and rasterized.

If no Base line and Base point were used, then the algorithm would have no way to find out which lines go where, it would simply paint lines "where it sees fit" preventing the coordination required to achieve a coherent hatching instead of just black blobs of paint or overlapping lines that would happen if one simply cloned a set of lines.

If a tool can achieve this coordination without an Origin point, then it is actually taking point (0, 0) as a base point. I preferred to let the user decide where his base point goes, even if most of the time he will just leave the default on. This has the advantage of making the brush resize resistant.


Crosshatching Options

Those options work differently whether the [ ] Crosshatching curve option is checked or not. The curve can work as a function of many input parameters, but the most commonly used is surely pressure; therefore, in this section when we say "pressure" we will be actually talking about any input parameter. When the curve is not activated, all proposed hatching passes will be executed regardless of pressure.

  • No crosshatching: self explaining.
  • Perpendicular lines only: do a single pass of hatching when pressure <= 50%, add another pass perpendicular to the first otherwise.
  • -45 and then +45:

-- 0 - 33% pressure: single pass.

-- 33% - 67%: single pass plus another pass using the base angle minus 45 degrees (the result is a double hatch).

-- 67% - 100%: same as before but also add a pass using the base angle plus 45 degrees (the result is a triple hatch).

  • +45 and then -45: same as the previous but revert the order of the last 2 intervals.
  • Moire pattern: an experimental mode where the angle of the hatch is a function of the pressure, where 100% pressure = +180° spin and 0% pressure = 0° spin. This function works completely different if the [ ] Crosshatching curve option is deactivated, in that case it simply does another hatching pass using the base angle plus 10 degrees.


Separation Style

  • Input-based intervals: this option is only relevant when the [ ] Separation curve option is checked. This determines the number of intervals of pressure (or other input) to divide the separation curve. For example, if there is 3 intervals and the curve is using pressure as the input, then: 0-33% pressure = double the normal separation ; 33% - 67% pressure = normal separation ; 67 - 100% pressure = half the normal separation.


Hatching Preferences

Graphical Tweaks

  • Antialias: choose whether to use the Wu or DDA algorithm to trace lines, Wu for antialiased lines, DDA for aliased lines. The DDA algorithm allows only 1 px thick lines and so it must be substituted soon.
  • Subpixel precision: choose whether to preserve or strip off all subpixel data from the algorithm, this causes both coordinate and point to be rounded, save for "Thickness". The result of deactivating this is lines that don't thicken too much when the mouse is passed over them again. However, this also causes pressure-based separation to behave erratically.
  • Color Background: the background color is painted beneath lines before they are rendered, instead of tracing the lines over a transparent background.