KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines

  1. Painting with brushes
  2. :.,I don't know anything, nada, zilch, noppes about writing paint applications. So
  3. when I started working on Chalk, I felt I needed examples. I used the following
  4. sources:
  5. * The old Chalk brush code (http://webcvs.kde.org/cgi-bin/cvsweb.cgi/koffice/chalk/tools/kis_tool_brush.cc?rev=1.58&content-type=text/x-cvsweb-markup)
  6. * Peter Jodda's Perico (http://software.jodda.de/perico.html)
  7. * The source of the Gimp (both current and 0.99.11 -- the oldest version I could find) (http://www.gimp.org)
  8. * David Hodson's article on Gimp brushes (http://members.ozemail.com.au/~hodsond/gimpbrush.html)
  9. * Raph Levien's article on Gimp brushes (http://www.levien.com/gimp/brush-arch.html)
  10. Chalk uses the gimp's brush file formats: .gbr and .gih, for singe
  11. and pipeline brushes, respectively. These brushes contain one or more
  12. grayscale or rgba images. If the image is grayscale, the gray image is
  13. intended to be used as an alpha mask: each gray level corresponds to
  14. a certain alpha level, and when painting the current painting colour
  15. is composited in the image with this level as its alpha component. The
  16. image brushes should be masked -- i.e., these are coloured images placed
  17. on a white background. The white background should be made transparent,
  18. and then the brush image can be composited onto our image.
  19. This is currently only half supported: I make masks of everything,
  20. partly because I like that better, partly because until very recently
  21. there was no way of making out the difference between gray and rgb
  22. brushes because KisBrush didn't remember that bit of data.
  23. Making the initial mask of a brush is however by now pretty well done; the next
  24. problem is painting with those masks.
  25. Here we have two situations, one easy, one difficult. The easy one is the single
  26. mouse click. If the user clicks or taps with his stylus, we can composite the
  27. mask or the image at the pixel position of the mouse click.
  28. The difficult situation is drawing a line. This line needs to be antialiased.