summaryrefslogtreecommitdiffstats
path: root/chalk/doc/DESIGN.obsolete
blob: 3d218990af3ea5f785babd117fa71ff5b275900b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
A Perspective on Chalk's Design

  Chalk's codebase has been through as many changes as the app's name
  itself. It started with KImageShop (hence the 'kis' prefix one finds
  everwhere, and which would have been unnessary had Chalk used
  namespaces, one fancies), then became Krayon to end up as Chalk. The
  stated design goal was to create a application geared towards the
  more artistic user; the kind of user who settles down with his
  tablet to create a spot of Art. It ended up as a Gimp-clone, a Kimp,
  so to say.

  This document was the basis for a discussion on the chalk mailinglist:
  http://lists.kde.org/?l=kde-kimageshop&m=106530035202770&w=2. See the
  answer for some answers to the questions at the end.
  
Design Patterns

  Patrick Julien restructured Chalk to use a lot design patterns. Chalk
  appears to have a very solid base for blasting pixels to the screen,
  zooming, selecting and moving. These are what I recognize as his
  changes:

            * Change brushes handling to a generic Mediator pattern
              (kis_resource_mediator). Resources are brush shapes,
              patterns (and colours, too?) Patrick intended a Flyweight
              here.

            * The composite pattern is used in paint devices, layers, channels,
              etc. (What about masks?)

            * Change colourspace handling to a Strategy pattern
              (strategy/kis_strategy_color)

            * Change moving chunks of painting to a Strategy pattern
              (strategy/kis_strategy_move)

            * kis_factory points towards a Factory pattern Creates the 
              pluginserver and resourceserver.

            * Tools are created by a Factory pattern (but it isn't
              dynamic yet): kis_tool_factory. Tools are intended to
              become tdeparts.

            * There's the start of a Memento pattern for tools, but it
              doesn't seem to be used (kis_tool_memento). It was an 
              experiment that didn't pan out.

            * The Builder pattern is used to do conversion to and/or
              from ImageMagick. I guess this is used for importing
              images in other file-formats than .chalk. An idea at one
              was to use Koffice filters, but that didn't work because
              images are rather different from other office documents.

            * Flyweight pattern used for background tiles.
              kis_background.

            * Nameserver. Perhaps not a pattern -- at least not one
              with an obvious GOF name. Appears to be computing a
              number for new layers and new documents.

            * kis_render. Interface implemented by kis_paint_device
              and kis_image.

            * Rename kisTool to kisToolInterface -- but the file is
              still called kis_tool. (This is intentional, and should
              be kept in the style guide.)

            * Addition of kis_types. Defines shared pointer pointers
              to core chalk objects: image, paintdevice, channel,
              mask, layer etc.
             
            * Tile architecture. There's Mediator and a Singleton
              pattern here at least. This stuff seems to work, doesn't
              need hacking at the moment.
              
            * Visitor pattern used to flatten an image or merge 
              layers. Merging exposes a funny bug where the tiles
              are re-arranged in an interesting mosaic pattern.


User interface

  Chalk uses a fairly ugly side-panel to collect what are palettes
  in other applications. I would prefer dockable, attachable
  palettes myself. Doesn't KDE have a lib for that already?


  ui/labels

        These classes are used in the statusbar.

  ui

        The dialogs appear to be created by hand, not with TQt
        Designer. Besides, many are inoperational.
        
  other

        The canvas, rules and sidebar panels are defined here, too,
        nicely separated.

Tools

  Working: select_rectangular, test, zoom, colorpicker, paste, move

  Not working: airbrush, brush, colorchanger (no idea what it should
  do), ellipse, eraser, fill, line, pen, polygon, polyline, 
  rectangle, select_contiguous, select_elliptical, select_freehand,
  select_polygonal, stamp

  Missing tools: convolve, smear, smudge, whirl, charcoal, chalk,
  oils, clone, select_by_colour

Plugins

  The single plugin example has been present in chalk since about day
  one, as far as I can see. It doesn't show anything about what one
  can do with plugins.

  To judge from the code in kis_plugin_server, it never got beyond
  an idea. (kdDebug() << "hallo\n"...)

  (This code should be removed.)

ImageMagick

  There still appear to be some dependencies upon ImageMagick (builder
  subdir). What are these for, and should they stay? Is it for
  importing/exporting foreign file formats?

Undo/Redo

  Undo and Redo make use of the standard KDE mechanism, which I don't
  really understand either.


Obsolete files

  The following files appear to be unused:

    core/helper/kis_timer
    core/helper/kis_scopedlock (Replaced with QMutexlocker)
    core/kis_krayon (was predecessor of kis_resource)
    core/kis_mask
    core/kis_util
    ui/kis_krayon_widget

Random head-scratchings


       - Why the QUANTUM redefinition: the number of bits per channel,
         8 for 32-bit colour, 16 for 64-bit colour.

       - is_mask unimplemented? What was it meant to do, or is it an
       interface?

       - nameserver presents unique numbers for new layers and images.

       - what does 'upscale' do?  in 8 bit/channel color mode, upscale
         doesn't do anything.  However, downscale and upscale in > 8 bit,
         this is needed to covert the color for the actual display 
         rendering, i.e. X, etc, only do 8 bit color. Using this 
         everywhere you work on color will keep chalk color channel
         bit depth independent.


       - Is KisVector only used in obsolete tools?

       - I take it that the two tests that are present in chalk/test
       are obsolete?

       - what with the dummmmmy.cpp?

       - which bits of the chalk/ui files are still relevant?

       - kis_selection.h needs to be included to compile code that
         uses kis_paint_device, and I wonder why.

       - what is paint-offset?