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.

180 lines
6.2KB

  1. A Perspective on Chalk's Design
  2. Chalk's codebase has been through as many changes as the app's name
  3. itself. It started with KImageShop (hence the 'kis' prefix one finds
  4. everwhere, and which would have been unnessary had Chalk used
  5. namespaces, one fancies), then became Krayon to end up as Chalk. The
  6. stated design goal was to create a application geared towards the
  7. more artistic user; the kind of user who settles down with his
  8. tablet to create a spot of Art. It ended up as a Gimp-clone, a Kimp,
  9. so to say.
  10. This document was the basis for a discussion on the chalk mailinglist:
  11. http://lists.kde.org/?l=kde-kimageshop&m=106530035202770&w=2. See the
  12. answer for some answers to the questions at the end.
  13. Design Patterns
  14. Patrick Julien restructured Chalk to use a lot design patterns. Chalk
  15. appears to have a very solid base for blasting pixels to the screen,
  16. zooming, selecting and moving. These are what I recognize as his
  17. changes:
  18. * Change brushes handling to a generic Mediator pattern
  19. (kis_resource_mediator). Resources are brush tqshapes,
  20. patterns (and colours, too?) Patrick intended a Flyweight
  21. here.
  22. * The composite pattern is used in paint devices, layers, channels,
  23. etc. (What about masks?)
  24. * Change colourspace handling to a Strategy pattern
  25. (strategy/kis_strategy_color)
  26. * Change moving chunks of painting to a Strategy pattern
  27. (strategy/kis_strategy_move)
  28. * kis_factory points towards a Factory pattern Creates the
  29. pluginserver and resourceserver.
  30. * Tools are created by a Factory pattern (but it isn't
  31. dynamic yet): kis_tool_factory. Tools are intended to
  32. become kparts.
  33. * There's the start of a Memento pattern for tools, but it
  34. doesn't seem to be used (kis_tool_memento). It was an
  35. experiment that didn't pan out.
  36. * The Builder pattern is used to do conversion to and/or
  37. from ImageMagick. I guess this is used for importing
  38. images in other file-formats than .chalk. An idea at one
  39. was to use Koffice filters, but that didn't work because
  40. images are rather different from other office documents.
  41. * Flyweight pattern used for background tiles.
  42. kis_background.
  43. * Nameserver. Perhaps not a pattern -- at least not one
  44. with an obvious GOF name. Appears to be computing a
  45. number for new layers and new documents.
  46. * kis_render. Interface implemented by kis_paint_device
  47. and kis_image.
  48. * Rename kisTool to kisToolInterface -- but the file is
  49. still called kis_tool. (This is intentional, and should
  50. be kept in the style guide.)
  51. * Addition of kis_types. Defines shared pointer pointers
  52. to core chalk objects: image, paintdevice, channel,
  53. mask, layer etc.
  54. * Tile architecture. There's Mediator and a Singleton
  55. pattern here at least. This stuff seems to work, doesn't
  56. need hacking at the moment.
  57. * Visitor pattern used to flatten an image or merge
  58. layers. Merging exposes a funny bug where the tiles
  59. are re-arranged in an interesting mosaic pattern.
  60. User interface
  61. Chalk uses a fairly ugly side-panel to collect what are palettes
  62. in other applications. I would prefer dockable, attachable
  63. palettes myself. Doesn't KDE have a lib for that already?
  64. ui/labels
  65. These classes are used in the statusbar.
  66. ui
  67. The dialogs appear to be created by hand, not with Qt
  68. Designer. Besides, many are inoperational.
  69. other
  70. The canvas, rules and sidebar panels are defined here, too,
  71. nicely separated.
  72. Tools
  73. Working: select_rectangular, test, zoom, colorpicker, paste, move
  74. Not working: airbrush, brush, colorchanger (no idea what it should
  75. do), ellipse, eraser, fill, line, pen, polygon, polyline,
  76. rectangle, select_contiguous, select_elliptical, select_freehand,
  77. select_polygonal, stamp
  78. Missing tools: convolve, smear, smudge, whirl, charcoal, chalk,
  79. oils, clone, select_by_colour
  80. Plugins
  81. The single plugin example has been present in chalk since about day
  82. one, as far as I can see. It doesn't show anything about what one
  83. can do with plugins.
  84. To judge from the code in kis_plugin_server, it never got beyond
  85. an idea. (kdDebug() << "hallo\n"...)
  86. (This code should be removed.)
  87. ImageMagick
  88. There still appear to be some dependencies upon ImageMagick (builder
  89. subdir). What are these for, and should they stay? Is it for
  90. importing/exporting foreign file formats?
  91. Undo/Redo
  92. Undo and Redo make use of the standard KDE mechanism, which I don't
  93. really understand either.
  94. Obsolete files
  95. The following files appear to be unused:
  96. core/helper/kis_timer
  97. core/helper/kis_scopedlock (Replaced with QMutexlocker)
  98. core/kis_krayon (was predecessor of kis_resource)
  99. core/kis_mask
  100. core/kis_util
  101. ui/kis_krayon_widget
  102. Random head-scratchings
  103. - Why the QUANTUM redefinition: the number of bits per channel,
  104. 8 for 32-bit colour, 16 for 64-bit colour.
  105. - is_mask unimplemented? What was it meant to do, or is it an
  106. interface?
  107. - nameserver presents unique numbers for new layers and images.
  108. - what does 'upscale' do? in 8 bit/channel color mode, upscale
  109. doesn't do anything. However, downscale and upscale in > 8 bit,
  110. this is needed to covert the color for the actual display
  111. rendering, i.e. X, etc, only do 8 bit color. Using this
  112. everywhere you work on color will keep chalk color channel
  113. bit depth independent.
  114. - Is KisVector only used in obsolete tools?
  115. - I take it that the two tests that are present in chalk/test
  116. are obsolete?
  117. - what with the dummmmmy.cc?
  118. - which bits of the chalk/ui files are still relevant?
  119. - kis_selection.h needs to be included to compile code that
  120. uses kis_paint_device, and I wonder why.
  121. - what is paint-offset?